Polish
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016-2017 the original author or authors.
|
||||
* Copyright 2016-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,7 +21,6 @@ import java.util.List;
|
||||
import org.springframework.batch.item.ExecutionContext;
|
||||
import org.springframework.cloud.task.listener.TaskExecutionListenerSupport;
|
||||
import org.springframework.cloud.task.repository.TaskExecution;
|
||||
import org.springframework.core.env.SimpleCommandLinePropertySource;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016-2017 the original author or authors.
|
||||
* Copyright 2016-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2017 the original author or authors.
|
||||
* Copyright 2015-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2017 the original author or authors.
|
||||
* Copyright 2015-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -158,22 +158,18 @@ public class TaskLifecycleListenerTests {
|
||||
|
||||
@Test
|
||||
public void testNoClosingOfContext() {
|
||||
ConfigurableApplicationContext applicationContext = SpringApplication.run(new Class[]{TestDefaultConfiguration.class, PropertyPlaceholderAutoConfiguration.class},
|
||||
new String[] {"--spring.cloud.task.closecontext_enabled=false"});
|
||||
|
||||
try {
|
||||
try (ConfigurableApplicationContext applicationContext = SpringApplication.run(new Class[] {TestDefaultConfiguration.class, PropertyPlaceholderAutoConfiguration.class},
|
||||
new String[] {"--spring.cloud.task.closecontext_enabled=false"})) {
|
||||
assertTrue(applicationContext.isActive());
|
||||
}
|
||||
finally {
|
||||
applicationContext.close();
|
||||
}
|
||||
}
|
||||
|
||||
@Test(expected = ApplicationContextException.class)
|
||||
public void testInvalidTaskExecutionId() {
|
||||
ConfigurableEnvironment environment = new StandardEnvironment();
|
||||
MutablePropertySources propertySources = environment.getPropertySources();
|
||||
Map myMap = new HashMap();
|
||||
Map<String, Object> myMap = new HashMap<>();
|
||||
myMap.put("spring.cloud.task.executionid", "55");
|
||||
propertySources.addFirst(new MapPropertySource("EnvrionmentTestPropsource", myMap));
|
||||
context.setEnvironment(environment);
|
||||
@@ -195,7 +191,7 @@ public class TaskLifecycleListenerTests {
|
||||
public void testExternalExecutionId() {
|
||||
ConfigurableEnvironment environment = new StandardEnvironment();
|
||||
MutablePropertySources propertySources = environment.getPropertySources();
|
||||
Map myMap = new HashMap();
|
||||
Map<String, Object> myMap = new HashMap<>();
|
||||
myMap.put("spring.cloud.task.external-execution-id", "myid");
|
||||
propertySources.addFirst(new MapPropertySource("EnvrionmentTestPropsource", myMap));
|
||||
context.setEnvironment(environment);
|
||||
@@ -209,7 +205,7 @@ public class TaskLifecycleListenerTests {
|
||||
public void testParentExecutionId() {
|
||||
ConfigurableEnvironment environment = new StandardEnvironment();
|
||||
MutablePropertySources propertySources = environment.getPropertySources();
|
||||
Map myMap = new HashMap();
|
||||
Map<String, Object> myMap = new HashMap<>();
|
||||
myMap.put("spring.cloud.task.parentExecutionId", 789);
|
||||
propertySources.addFirst(new MapPropertySource("EnvrionmentTestPropsource", myMap));
|
||||
context.setEnvironment(environment);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -62,11 +62,11 @@ public class TaskEventTests {
|
||||
ConfigurableApplicationContext applicationContext = new SpringApplicationBuilder().sources(new Class[] {TaskEventsConfiguration.class,
|
||||
TaskEventAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class,
|
||||
RabbitServiceAutoConfiguration.class}).build().run(new String[] {"--spring.cloud.task.closecontext_enabled=false",
|
||||
RabbitServiceAutoConfiguration.class}).build().run("--spring.cloud.task.closecontext_enabled=false",
|
||||
"--spring.cloud.task.name=" + TASK_NAME,
|
||||
"--spring.main.web-environment=false",
|
||||
"--spring.cloud.stream.defaultBinder=rabbit",
|
||||
"--spring.cloud.stream.bindings.task-events.destination=test"});
|
||||
"--spring.cloud.stream.bindings.task-events.destination=test");
|
||||
assertNotNull(applicationContext.getBean("taskEventListener"));
|
||||
assertNotNull(applicationContext.getBean(TaskEventAutoConfiguration.TaskEventChannels.class));
|
||||
assertTrue(latch.await(1, TimeUnit.SECONDS));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -58,8 +58,8 @@ import static org.junit.Assert.assertTrue;
|
||||
public class JobExecutionEventTests {
|
||||
|
||||
private static final String JOB_NAME = "FOODJOB";
|
||||
private static final Long JOB_INSTANCE_ID = 1l;
|
||||
private static final Long JOB_EXECUTION_ID = 2l;
|
||||
private static final Long JOB_INSTANCE_ID = 1L;
|
||||
private static final Long JOB_EXECUTION_ID = 2L;
|
||||
private static final String JOB_CONFIGURATION_NAME = "FOO_JOB_CONFIG";
|
||||
private static final String[] LISTENER_BEAN_NAMES = {BatchEventAutoConfiguration.JOB_EXECUTION_EVENTS_LISTENER,
|
||||
BatchEventAutoConfiguration.STEP_EXECUTION_EVENTS_LISTENER, BatchEventAutoConfiguration.CHUNK_EVENTS_LISTENER,
|
||||
@@ -97,7 +97,7 @@ public class JobExecutionEventTests {
|
||||
JobParameter[] PARAMETERS = {new JobParameter("FOO", true), new JobParameter(1L, true),
|
||||
new JobParameter(1D, true), new JobParameter(testDate, false)};
|
||||
|
||||
Map jobParamMap = new LinkedHashMap<>();
|
||||
Map<String, JobParameter> jobParamMap = new LinkedHashMap<>();
|
||||
for (int paramCount = 0; paramCount < JOB_PARAM_KEYS.length; paramCount++) {
|
||||
jobParamMap.put(JOB_PARAM_KEYS[paramCount], PARAMETERS[paramCount]);
|
||||
}
|
||||
@@ -296,7 +296,7 @@ public class JobExecutionEventTests {
|
||||
}
|
||||
}
|
||||
|
||||
public void testDisabledConfiguration(String property, String disabledListener) {
|
||||
private void testDisabledConfiguration(String property, String disabledListener) {
|
||||
boolean exceptionThrown = false;
|
||||
String disabledPropertyArg = (property != null) ? "--" + property + "=false" : "";
|
||||
ConfigurableApplicationContext applicationContext =
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
Reference in New Issue
Block a user