Updated based on Code Review
This commit is contained in:
@@ -112,7 +112,7 @@ public class MapTaskExecutionDaoTests {
|
||||
|
||||
@Test
|
||||
public void testJobQueries(){
|
||||
List<TaskExecution> expectedTaskExecutionList = new ArrayList<TaskExecution>(2);
|
||||
List<TaskExecution> expectedTaskExecutionList = new ArrayList<>(2);
|
||||
expectedTaskExecutionList.add(TestVerifierUtils.createSampleTaskExecutionNoArg());
|
||||
expectedTaskExecutionList.add(TestVerifierUtils.createSampleTaskExecutionNoArg());
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ public class JobInstanceEvent extends Entity {
|
||||
private String jobName;
|
||||
|
||||
public JobInstanceEvent() {
|
||||
|
||||
super(-1L);
|
||||
}
|
||||
|
||||
public JobInstanceEvent(Long id, String jobName) {
|
||||
|
||||
@@ -44,7 +44,7 @@ public class JobInstanceEventTests {
|
||||
assertNull(jobInstanceEvent.getJobName());
|
||||
}
|
||||
|
||||
@Test(expected = NullPointerException.class)
|
||||
@Test
|
||||
public void testEmptyConstructorEmptyId() {
|
||||
JobInstanceEvent jobInstanceEvent = new JobInstanceEvent();
|
||||
jobInstanceEvent.getInstanceId();
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright 2016 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.task.launcher;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.deployer.spi.local.LocalDeployerProperties;
|
||||
import org.springframework.cloud.deployer.spi.local.LocalTaskLauncher;
|
||||
import org.springframework.cloud.deployer.spi.task.TaskLauncher;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
|
||||
/**
|
||||
* Tests the TaskLauncherConfiguration in a case where a TaskLauncher is already
|
||||
* present.
|
||||
*
|
||||
* @author Glenn Renfro
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes =
|
||||
{TaskLaunchConfigurationExistingTests.TestTaskDeployerConfiguration.class,
|
||||
TaskLauncherConfiguration.class})
|
||||
public class TaskLaunchConfigurationExistingTests {
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext context;
|
||||
|
||||
private static TaskLauncher testTaskLauncher;
|
||||
|
||||
@Test
|
||||
public void testTaskLauncher() {
|
||||
LocalTaskLauncher taskLauncher =
|
||||
context.getBean(LocalTaskLauncher.class);
|
||||
assertNotNull(testTaskLauncher);
|
||||
assertNotNull(taskLauncher);
|
||||
assertEquals(testTaskLauncher, taskLauncher);
|
||||
}
|
||||
|
||||
@Configuration
|
||||
protected static class TestTaskDeployerConfiguration {
|
||||
@Bean
|
||||
public TaskLauncher taskLauncher() {
|
||||
testTaskLauncher =
|
||||
new LocalTaskLauncher(new LocalDeployerProperties());
|
||||
return testTaskLauncher;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,10 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
/**
|
||||
* @author Glenn Renfro
|
||||
* Tests the TaskLauncherConfiguration in a case where a TaskLauncher is not
|
||||
* present.
|
||||
*
|
||||
* @author Glenn Renfro
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = {TaskLauncherConfiguration.class})
|
||||
|
||||
@@ -36,8 +36,8 @@ public class TaskLaunchRequestTests {
|
||||
|
||||
@Test
|
||||
public void testEquals() {
|
||||
List args = new ArrayList<String>();
|
||||
Map map = new HashMap<String,String>();
|
||||
List<String> args = new ArrayList<>();
|
||||
Map<String, String> map = new HashMap<>();
|
||||
args.add("foo");
|
||||
map.put("bar", "baz");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user