Remove usage of master/slave terminology

This commit is contained in:
Mahmoud Ben Hassine
2021-08-17 21:59:30 +02:00
parent 24152e7a57
commit 36b63ed283
33 changed files with 120 additions and 99 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2007 the original author or authors.
* Copyright 2006-2021 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.
@@ -37,6 +37,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
* @author Dave Syer
* @author Mahmoud Ben Hassine
*
*/
@ContextConfiguration(locations = "launch-context.xml")
@@ -74,7 +75,7 @@ public class RestartIntegrationTests {
ExampleItemReader.fail = true;
JobParameters jobParameters = new JobParametersBuilder().addString("restart", "yes").toJobParameters();
int beforeMaster = jdbcTemplate.queryForObject("SELECT COUNT(*) from BATCH_STEP_EXECUTION where STEP_NAME='step1:master'", Integer.class);
int beforeManager = jdbcTemplate.queryForObject("SELECT COUNT(*) from BATCH_STEP_EXECUTION where STEP_NAME='step1:manager'", Integer.class);
int beforePartition = jdbcTemplate.queryForObject("SELECT COUNT(*) from BATCH_STEP_EXECUTION where STEP_NAME like 'step1:partition%'", Integer.class);
ExampleItemWriter.clear();
@@ -88,11 +89,11 @@ public class RestartIntegrationTests {
// Only 4 because the others were processed in the first attempt
assertEquals(4, ExampleItemWriter.getItems().size());
int afterMaster = jdbcTemplate.queryForObject("SELECT COUNT(*) from BATCH_STEP_EXECUTION where STEP_NAME='step1:master'", Integer.class);
int afterManager = jdbcTemplate.queryForObject("SELECT COUNT(*) from BATCH_STEP_EXECUTION where STEP_NAME='step1:manager'", Integer.class);
int afterPartition = jdbcTemplate.queryForObject("SELECT COUNT(*) from BATCH_STEP_EXECUTION where STEP_NAME like 'step1:partition%'", Integer.class);
// Two attempts
assertEquals(2, afterMaster-beforeMaster);
assertEquals(2, afterManager-beforeManager);
// One failure and two successes
assertEquals(3, afterPartition-beforePartition);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2007 the original author or authors.
* Copyright 2006-2021 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.
@@ -32,6 +32,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
* @author Dave Syer
* @author Mahmoud Ben Hassine
*
*/
@ContextConfiguration(locations="launch-context.xml")
@@ -58,12 +59,12 @@ public class VanillaIntegrationTests {
@Test
public void testLaunchJob() throws Exception {
int beforeMaster = jdbcTemplate.queryForObject("SELECT COUNT(*) from BATCH_STEP_EXECUTION where STEP_NAME='step1:master'", Integer.class);
int beforeManager = jdbcTemplate.queryForObject("SELECT COUNT(*) from BATCH_STEP_EXECUTION where STEP_NAME='step1:manager'", Integer.class);
int beforePartition = jdbcTemplate.queryForObject("SELECT COUNT(*) from BATCH_STEP_EXECUTION where STEP_NAME like 'step1:partition%'", Integer.class);
assertNotNull(jobLauncher.run(job, new JobParameters()));
int afterMaster = jdbcTemplate.queryForObject("SELECT COUNT(*) from BATCH_STEP_EXECUTION where STEP_NAME='step1:master'", Integer.class);
int afterManager = jdbcTemplate.queryForObject("SELECT COUNT(*) from BATCH_STEP_EXECUTION where STEP_NAME='step1:manager'", Integer.class);
int afterPartition = jdbcTemplate.queryForObject("SELECT COUNT(*) from BATCH_STEP_EXECUTION where STEP_NAME like 'step1:partition%'", Integer.class);
assertEquals(1, afterMaster-beforeMaster);
assertEquals(1, afterManager-beforeManager);
// Should be same as grid size in step splitter
assertEquals(2, afterPartition-beforePartition);
}