Skip to content

Commit

Permalink
Take care of some deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
hpoettker authored and fmbenhassine committed Oct 13, 2023
1 parent cf1f34b commit f7ec69e
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, B
registerAutomaticJobRegistrar(registry, batchAnnotation);
watch.stop();
LOGGER.info(LogMessage.format("Finished Spring Batch infrastructure beans configuration in %s ms.",
watch.getLastTaskTimeMillis()));
watch.lastTaskInfo().getTimeMillis()));
}

private void validateState(AnnotationMetadata importingClassMetadata) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2006-2007 the original author or authors.
* Copyright 2006-2023 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.
Expand Down Expand Up @@ -28,8 +28,6 @@ public interface SystemExiter {
/**
* Terminate the currently running Java Virtual Machine.
* @param status exit status.
* @throws SecurityException if a security manager exists and its
* <code>checkExit</code> method doesn't allow exit with the specified status.
* @see System#exit(int)
*/
void exit(int status);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2006-2022 the original author or authors.
* Copyright 2006-2023 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.
Expand Down Expand Up @@ -39,9 +39,6 @@ public interface CommandRunner {
* @param dir the working directory of the subprocess, or {@code null} if the
* subprocess should inherit the working directory of the current process.
* @return A new {@link Process} object for managing the subprocess
* @throws SecurityException If a security manager exists and its
* {@link SecurityManager#checkExec checkExec} method doesn't allow creation of the
* subprocess
* @throws IOException If an I/O error occurs
* @throws NullPointerException If {@code command} is {@code null}, or one of the
* elements of {@code envp} is {@code null}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2006-2022 the original author or authors.
* Copyright 2006-2023 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.
Expand Down Expand Up @@ -31,8 +31,8 @@
import org.springframework.batch.item.ItemStream;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.core.task.SyncTaskExecutor;
import org.springframework.retry.RetryListener;
import org.springframework.scheduling.concurrent.ConcurrentTaskExecutor;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import org.springframework.test.util.ReflectionTestUtils;
import org.springframework.transaction.annotation.Isolation;
Expand Down Expand Up @@ -90,7 +90,7 @@ void testStepWithTask() throws Exception {
Object txq = ReflectionTestUtils.getField(factory, "readerTransactionalQueue");
assertEquals(true, txq, "wrong reader-transactional-queue:");
Object te = ReflectionTestUtils.getField(factory, "taskExecutor");
assertEquals(ConcurrentTaskExecutor.class, te.getClass(), "wrong task-executor:");
assertEquals(SyncTaskExecutor.class, te.getClass(), "wrong task-executor:");
Object listeners = ReflectionTestUtils.getField(factory, "stepExecutionListeners");
assertEquals(2, ((Set<StepExecutionListener>) listeners).size(), "wrong number of listeners:");
Object retryListeners = ReflectionTestUtils.getField(factory, "retryListeners");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ void testNestedSplitsWithSingleThread() {
FlowBuilder.SplitBuilder<SimpleFlow> splitBuilder = flowBuilder.split(taskExecutor);
splitBuilder.add(new FlowBuilder<Flow>("subflow1").from(step1).end());
splitBuilder.add(new FlowBuilder<Flow>("subflow2").from(step2).end());
Job job = new JobBuilder("job").repository(jobRepository).start(flowBuilder.build()).end().build();
Job job = new JobBuilder("job", jobRepository).start(flowBuilder.build()).end().build();
job.execute(execution);

assertEquals(BatchStatus.COMPLETED, execution.getStatus());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 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.
Expand All @@ -23,6 +23,7 @@
import org.junit.jupiter.api.Test;

import org.springframework.batch.core.BatchStatus;
import org.springframework.batch.core.ChunkListener;
import org.springframework.batch.core.ExitStatus;
import org.springframework.batch.core.ItemReadListener;
import org.springframework.batch.core.JobParameters;
Expand All @@ -42,7 +43,6 @@
import org.springframework.batch.core.configuration.xml.DummyItemReader;
import org.springframework.batch.core.configuration.xml.DummyItemWriter;
import org.springframework.batch.core.job.SimpleJob;
import org.springframework.batch.core.listener.ChunkListenerSupport;
import org.springframework.batch.core.repository.JobRepository;
import org.springframework.batch.core.repository.support.JobRepositoryFactoryBean;
import org.springframework.batch.item.ItemReader;
Expand Down Expand Up @@ -237,7 +237,7 @@ private void assertStepFunctions(boolean faultTolerantStep) throws Exception {

@Test
void testReturnedTypeOfChunkListenerIsAssignableToSimpleStepBuilder() throws Exception {
testReturnedTypeOfSetterIsAssignableToSimpleStepBuilder(builder -> builder.listener(new ChunkListenerSupport() {
testReturnedTypeOfSetterIsAssignableToSimpleStepBuilder(builder -> builder.listener(new ChunkListener() {
}));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@
import org.springframework.batch.item.WriterNotOpenException;
import org.springframework.batch.item.support.AbstractItemStreamItemReader;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.core.task.SyncTaskExecutor;
import org.springframework.jdbc.support.JdbcTransactionManager;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabase;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder;
import org.springframework.lang.Nullable;
import org.springframework.scheduling.concurrent.ConcurrentTaskExecutor;
import org.springframework.test.util.ReflectionTestUtils;
import org.springframework.util.StringUtils;

Expand Down Expand Up @@ -870,7 +870,7 @@ public String read() {
};

factory.setItemReader(reader);
factory.setTaskExecutor(new ConcurrentTaskExecutor());
factory.setTaskExecutor(new SyncTaskExecutor());

Step step = factory.getObject();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@

<beans:bean id="retryListener" class="org.springframework.batch.core.configuration.xml.TestRetryListener" />

<beans:bean id="taskExecutor" class="org.springframework.scheduling.concurrent.ConcurrentTaskExecutor" />
<beans:bean id="taskExecutor" class="org.springframework.core.task.SyncTaskExecutor" />

</beans:beans>
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

<beans:bean id="listener" class="org.springframework.batch.core.configuration.xml.TestListener" />

<beans:bean id="taskExecutor" class="org.springframework.scheduling.concurrent.ConcurrentTaskExecutor" />
<beans:bean id="taskExecutor" class="org.springframework.core.task.SyncTaskExecutor" />

<job-repository id="jobRepository" table-prefix="BATCH_"/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@

<beans:bean id="retryListener" class="org.springframework.batch.core.configuration.xml.TestRetryListener" />

<beans:bean id="taskExecutor" class="org.springframework.scheduling.concurrent.ConcurrentTaskExecutor" />
<beans:bean id="taskExecutor" class="org.springframework.core.task.SyncTaskExecutor" />

</beans:beans>

0 comments on commit f7ec69e

Please sign in to comment.