Migrate Task to Spring Cloud Build 2.0.x

resolves #313
This commit is contained in:
Glenn Renfro
2017-05-22 09:15:44 -04:00
committed by Michael Minella
parent 54bce9a590
commit d95f46002f
32 changed files with 74 additions and 74 deletions

View File

@@ -245,10 +245,10 @@ public class MapTaskExecutionDao implements TaskExecutionDao {
}
private Page getPageFromList(List<TaskExecution> executionList, Pageable pageable, long maxSize){
int toIndex = (pageable.getOffset() + pageable.getPageSize() > executionList.size()) ?
long toIndex = (pageable.getOffset() + pageable.getPageSize() > executionList.size()) ?
executionList.size() : pageable.getOffset() + pageable.getPageSize();
return new PageImpl<>(
executionList.subList(pageable.getOffset(), toIndex),
executionList.subList((int)pageable.getOffset(), (int)toIndex),
pageable, maxSize);
}
}

View File

@@ -28,7 +28,7 @@ public class Db2PagingQueryProvider extends AbstractSqlPagingQueryProvider {
@Override
public String getPageQuery(Pageable pageable) {
int offset = pageable.getOffset() + 1;
long offset = pageable.getOffset() + 1;
return generateRowNumSqlQueryWithNesting(getSelectClause(), false,
"TMP_ROW_NUM BETWEEN " + offset + " AND " + (offset + pageable.getPageSize()));
}

View File

@@ -28,7 +28,7 @@ public class OraclePagingQueryProvider extends AbstractSqlPagingQueryProvider {
@Override
public String getPageQuery(Pageable pageable) {
int offset = pageable.getOffset()+1;
long offset = pageable.getOffset()+1;
return generateRowNumSqlQueryWithNesting(getSelectClause(), false, "TMP_ROW_NUM >= "
+ offset + " AND TMP_ROW_NUM < " + (offset+pageable.getPageSize()));
}

View File

@@ -27,7 +27,7 @@ public class SqlServerPagingQueryProvider extends AbstractSqlPagingQueryProvider
@Override
public String getPageQuery(Pageable pageable) {
int offset = pageable.getOffset()+1;
long offset = pageable.getOffset()+1;
return generateRowNumSqlQueryWithNesting(getSelectClause(), false, "TMP_ROW_NUM >= "
+ offset + " AND TMP_ROW_NUM < " + (offset+pageable.getPageSize()));
}

View File

@@ -17,7 +17,6 @@
package org.springframework.cloud.task;
import java.util.Properties;
import javax.sql.DataSource;
import org.junit.After;

View File

@@ -5,7 +5,7 @@ import org.junit.Rule;
import org.junit.Test;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration;
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.test.rule.OutputCapture;
import org.springframework.cloud.task.configuration.EnableTask;
@@ -48,7 +48,7 @@ public class TaskCoreTests {
@Test
public void successfulTaskTest() {
applicationContext = new SpringApplicationBuilder().sources(new Object[]{TaskConfiguration.class,
applicationContext = new SpringApplicationBuilder().sources(new Class[]{TaskConfiguration.class,
PropertyPlaceholderAutoConfiguration.class}).build().run(new String[]{
"--spring.cloud.task.closecontext.enable=false",
"--spring.cloud.task.name=" + TASK_NAME,
@@ -67,8 +67,8 @@ public class TaskCoreTests {
public void exceptionTaskTest() {
boolean exceptionFired = false;
try {
applicationContext = new SpringApplicationBuilder().sources(new Object[]{TaskExceptionConfiguration.class,
PropertyPlaceholderAutoConfiguration.class}).build().run(new String[]{
applicationContext = new SpringApplicationBuilder().sources(TaskExceptionConfiguration.class,
PropertyPlaceholderAutoConfiguration.class).build().run(new String[]{
"--spring.cloud.task.closecontext.enable=false",
"--spring.cloud.task.name=" + TASK_NAME,
"--spring.main.web-environment=false"});
@@ -95,8 +95,8 @@ public class TaskCoreTests {
public void invalidExecutionId() {
boolean exceptionFired = false;
try {
applicationContext = new SpringApplicationBuilder().sources(new Object[]{TaskExceptionConfiguration.class,
PropertyPlaceholderAutoConfiguration.class}).build().run(new String[]{
applicationContext = new SpringApplicationBuilder().sources(TaskExceptionConfiguration.class,
PropertyPlaceholderAutoConfiguration.class).build().run(new String[]{
"--spring.cloud.task.closecontext.enable=false",
"--spring.cloud.task.name=" + TASK_NAME,
"--spring.main.web-environment=false",

View File

@@ -23,7 +23,7 @@ import org.junit.After;
import org.junit.Test;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration;
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
import org.springframework.boot.context.event.ApplicationFailedEvent;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.cloud.task.listener.annotation.AfterTask;

View File

@@ -30,11 +30,10 @@ import org.junit.Test;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ExitCodeEvent;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration;
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
import org.springframework.boot.context.event.ApplicationFailedEvent;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.boot.test.rule.OutputCapture;
import org.springframework.cloud.task.configuration.TaskProperties;
import org.springframework.cloud.task.repository.TaskExecution;
import org.springframework.cloud.task.repository.TaskExplorer;
import org.springframework.cloud.task.util.TestDefaultConfiguration;
@@ -139,7 +138,7 @@ public class TaskLifecycleListenerTests {
@Test
public void testNoClosingOfContext() {
ConfigurableApplicationContext applicationContext = SpringApplication.run(new Object[] {TestDefaultConfiguration.class, PropertyPlaceholderAutoConfiguration.class},
ConfigurableApplicationContext applicationContext = SpringApplication.run(new Class[]{TestDefaultConfiguration.class, PropertyPlaceholderAutoConfiguration.class},
new String[] {"--spring.cloud.task.closecontext_enable=false"});
try {

View File

@@ -28,7 +28,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration;
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.EmbeddedDataSourceConfiguration;
import org.springframework.cloud.task.configuration.TestConfiguration;
import org.springframework.cloud.task.repository.TaskExecution;

View File

@@ -44,7 +44,7 @@ import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration;
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.EmbeddedDataSourceConfiguration;
import org.springframework.cloud.task.configuration.TestConfiguration;
import org.springframework.cloud.task.repository.TaskExecution;

View File

@@ -26,7 +26,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration;
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.EmbeddedDataSourceConfiguration;
import org.springframework.cloud.task.configuration.SimpleTaskConfiguration;
import org.springframework.cloud.task.repository.TaskExecution;

View File

@@ -24,7 +24,7 @@ import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration;
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.EmbeddedDataSourceConfiguration;
import org.springframework.cloud.task.configuration.SimpleTaskConfiguration;
import org.springframework.cloud.task.configuration.TestConfiguration;