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:
committed by
Michael Minella
parent
4dbc256a4c
commit
4e68adf5fa
@@ -27,6 +27,7 @@ import org.junit.After;
|
|||||||
import org.junit.ClassRule;
|
import org.junit.ClassRule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import org.springframework.batch.core.scope.context.ChunkContext;
|
||||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||||
import org.springframework.cloud.stream.annotation.EnableBinding;
|
import org.springframework.cloud.stream.annotation.EnableBinding;
|
||||||
@@ -189,7 +190,7 @@ public class BatchExecutionEventTests {
|
|||||||
public static class ItemProcessListenerBinding {
|
public static class ItemProcessListenerBinding {
|
||||||
|
|
||||||
@StreamListener(Sink.INPUT)
|
@StreamListener(Sink.INPUT)
|
||||||
public void receive(Object object) {
|
public void receive(String object) {
|
||||||
itemProcessLatch.countDown();
|
itemProcessLatch.countDown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -200,7 +201,7 @@ public class BatchExecutionEventTests {
|
|||||||
public static class ChunkEventsListenerBinding {
|
public static class ChunkEventsListenerBinding {
|
||||||
|
|
||||||
@StreamListener(Sink.INPUT)
|
@StreamListener(Sink.INPUT)
|
||||||
public void receive(Object chunkContext) {
|
public void receive(ChunkContext chunkContext) {
|
||||||
chunkEventsLatch.countDown();
|
chunkEventsLatch.countDown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -223,7 +224,7 @@ public class BatchExecutionEventTests {
|
|||||||
private static final String SKIPPING_READ_MESSAGE = "Skipped when reading.";
|
private static final String SKIPPING_READ_MESSAGE = "Skipped when reading.";
|
||||||
private static final String SKIPPING_WRITE_CONTENT = "-1";
|
private static final String SKIPPING_WRITE_CONTENT = "-1";
|
||||||
@StreamListener(Sink.INPUT)
|
@StreamListener(Sink.INPUT)
|
||||||
public void receive(Object exceptionMessage) {
|
public void receive(String exceptionMessage) {
|
||||||
if(exceptionMessage.toString().equals(SKIPPING_READ_MESSAGE)){
|
if(exceptionMessage.toString().equals(SKIPPING_READ_MESSAGE)){
|
||||||
readSkipCount++;
|
readSkipCount++;
|
||||||
}
|
}
|
||||||
@@ -240,7 +241,7 @@ public class BatchExecutionEventTests {
|
|||||||
public static class ItemWriteEventsListenerBinding {
|
public static class ItemWriteEventsListenerBinding {
|
||||||
|
|
||||||
@StreamListener(Sink.INPUT)
|
@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 start with '3 items'", itemWrite.toString().startsWith("3 items "));
|
||||||
assertTrue("Message should end with ' written.'", itemWrite.toString().endsWith(" written."));
|
assertTrue("Message should end with ' written.'", itemWrite.toString().endsWith(" written."));
|
||||||
itemWriteEventsLatch.countDown();
|
itemWriteEventsLatch.countDown();
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>1.4.2.RELEASE</version>
|
<version>1.5.2.RELEASE</version>
|
||||||
<relativePath />
|
<relativePath />
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>1.4.2.RELEASE</version>
|
<version>1.5.2.RELEASE</version>
|
||||||
<relativePath />
|
<relativePath />
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>1.4.2.RELEASE</version>
|
<version>1.5.2.RELEASE</version>
|
||||||
<relativePath />
|
<relativePath />
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>1.4.2.RELEASE</version>
|
<version>1.5.2.RELEASE</version>
|
||||||
<relativePath />
|
<relativePath />
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>1.4.2.RELEASE</version>
|
<version>1.5.2.RELEASE</version>
|
||||||
<relativePath />
|
<relativePath />
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@@ -23,14 +23,11 @@ import org.junit.Test;
|
|||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.SpringApplicationConfiguration;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
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.messaging.Processor;
|
||||||
import org.springframework.cloud.stream.test.binder.MessageCollector;
|
import org.springframework.cloud.stream.test.binder.MessageCollector;
|
||||||
import org.springframework.cloud.task.launcher.TaskLaunchRequest;
|
import org.springframework.cloud.task.launcher.TaskLaunchRequest;
|
||||||
import org.springframework.messaging.support.GenericMessage;
|
import org.springframework.messaging.support.GenericMessage;
|
||||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
import static org.hamcrest.CoreMatchers.is;
|
import static org.hamcrest.CoreMatchers.is;
|
||||||
@@ -47,7 +44,6 @@ public class TaskProcessorApplicationTests {
|
|||||||
private static final String DEFAULT_PAYLOAD = "hello";
|
private static final String DEFAULT_PAYLOAD = "hello";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
@Bindings(TaskProcessor.class)
|
|
||||||
protected Processor channels;
|
protected Processor channels;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>1.4.2.RELEASE</version>
|
<version>1.5.2.RELEASE</version>
|
||||||
<relativePath />
|
<relativePath />
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@@ -24,16 +24,12 @@ import org.junit.Test;
|
|||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.SpringApplicationConfiguration;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.cloud.deployer.spi.task.LaunchState;
|
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.stream.messaging.Sink;
|
||||||
import org.springframework.cloud.task.launcher.TaskLaunchRequest;
|
import org.springframework.cloud.task.launcher.TaskLaunchRequest;
|
||||||
import org.springframework.cloud.task.launcher.TaskLauncherSink;
|
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.messaging.support.GenericMessage;
|
import org.springframework.messaging.support.GenericMessage;
|
||||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
@@ -50,7 +46,6 @@ public class TaskSinkApplicationTests {
|
|||||||
ApplicationContext context;
|
ApplicationContext context;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
@Bindings(TaskLauncherSink.class)
|
|
||||||
private Sink sink;
|
private Sink sink;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -58,7 +53,7 @@ public class TaskSinkApplicationTests {
|
|||||||
assertNotNull(this.sink.input());
|
assertNotNull(this.sink.input());
|
||||||
|
|
||||||
TaskSinkConfiguration.TestTaskLauncher testTaskLauncher =
|
TaskSinkConfiguration.TestTaskLauncher testTaskLauncher =
|
||||||
(TaskSinkConfiguration.TestTaskLauncher) context.getBean(TaskSinkConfiguration.TestTaskLauncher.class);
|
context.getBean(TaskSinkConfiguration.TestTaskLauncher.class);
|
||||||
|
|
||||||
Map<String, String> properties = new HashMap();
|
Map<String, String> properties = new HashMap();
|
||||||
properties.put("server.port", "0");
|
properties.put("server.port", "0");
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>1.4.2.RELEASE</version>
|
<version>1.5.2.RELEASE</version>
|
||||||
<relativePath />
|
<relativePath />
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import org.junit.Rule;
|
|||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
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.assertEquals;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import static org.junit.Assert.assertEquals;
|
|||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
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.AnnotationConfigApplicationContext;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package org.springframework.cloud.task.launcher.configuration;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.springframework.cloud.deployer.spi.core.AppDeploymentRequest;
|
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.LaunchState;
|
||||||
import org.springframework.cloud.deployer.spi.task.TaskLauncher;
|
import org.springframework.cloud.deployer.spi.task.TaskLauncher;
|
||||||
import org.springframework.cloud.deployer.spi.task.TaskStatus;
|
import org.springframework.cloud.deployer.spi.task.TaskStatus;
|
||||||
@@ -75,6 +76,11 @@ public class TaskConfiguration {
|
|||||||
throw new UnsupportedOperationException("Destroy is not supported");
|
throw new UnsupportedOperationException("Destroy is not supported");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RuntimeEnvironmentInfo environmentInfo() {
|
||||||
|
throw new UnsupportedOperationException("environmentInfo is not supported");
|
||||||
|
}
|
||||||
|
|
||||||
public List<String> getCommandlineArguments() {
|
public List<String> getCommandlineArguments() {
|
||||||
return commandlineArguments;
|
return commandlineArguments;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user