Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.springframework.batch.core.partition.Partitioner;
import org.springframework.batch.core.repository.JobRepository;
import org.springframework.batch.core.step.StepLocator;
import org.springframework.batch.core.step.builder.ChunkOrientedStepBuilder;
import org.springframework.batch.core.step.builder.FlowStepBuilder;
import org.springframework.batch.core.step.builder.JobStepBuilder;
import org.springframework.batch.core.step.builder.PartitionStepBuilder;
Expand Down Expand Up @@ -62,7 +63,9 @@
*
* @since 4.1
* @author Mahmoud Ben Hassine
* @author Yanming Zhou
*/
@SuppressWarnings("removal")
public class RemotePartitioningWorkerStepBuilder extends StepBuilder {

private static final String SERVICE_ACTIVATOR_METHOD_NAME = "handle";
Expand Down Expand Up @@ -162,6 +165,18 @@ public TaskletStepBuilder tasklet(Tasklet tasklet, PlatformTransactionManager tr
return super.tasklet(tasklet, transactionManager);
}

@Override
public TaskletStepBuilder tasklet(Tasklet tasklet) {
configureWorkerIntegrationFlow();
return super.tasklet(tasklet);
}

@Override
public <I, O> ChunkOrientedStepBuilder<I, O> chunk(int chunkSize) {
configureWorkerIntegrationFlow();
return super.chunk(chunkSize);
}

@Override
public <I, O> SimpleStepBuilder<I, O> chunk(int chunkSize, PlatformTransactionManager transactionManager) {
configureWorkerIntegrationFlow();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,24 @@

package org.springframework.batch.integration.partition;

import java.lang.reflect.Method;
import java.lang.reflect.Modifier;

import org.junit.jupiter.api.Test;
import org.mockito.Mock;

import org.springframework.batch.core.repository.JobRepository;
import org.springframework.batch.core.step.builder.StepBuilder;
import org.springframework.batch.core.step.tasklet.Tasklet;
import org.springframework.transaction.PlatformTransactionManager;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
import static org.junit.jupiter.api.Assertions.assertThrows;

/**
* @author Mahmoud Ben Hassine
* @author Yanming Zhou
*/
class RemotePartitioningWorkerStepBuilderTests {

Expand Down Expand Up @@ -110,4 +116,21 @@ void testMandatoryInputChannel() {
assertThat(expectedException).hasMessage("An InputChannel must be provided");
}

@Test
void testAllMethodsAreOverridden() throws Exception {
for (Method method : StepBuilder.class.getDeclaredMethods()) {
if (!Modifier.isPublic(method.getModifiers())) {
continue;
}
try {
RemotePartitioningWorkerStepBuilder.class.getDeclaredMethod(method.getName(),
method.getParameterTypes());
}
catch (NoSuchMethodException ex) {
fail(RemotePartitioningWorkerStepBuilder.class.getName() + " should override method [" + method
+ "] to configure worker integration flow.");
}
}
}

}