Skip to content
Open
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
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@
<jruby.version>9.4.13.0</jruby.version>
<lettuce.version>6.8.0.RELEASE</lettuce.version>
<jedis.version>6.1.0</jedis.version>
<vmlens.version>1.2.14</vmlens.version>

<!-- samples dependencies -->
<spring-rabbit.version>${spring-amqp.version}</spring-rabbit.version>
Expand Down
29 changes: 29 additions & 0 deletions spring-batch-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,12 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.vmlens</groupId>
<artifactId>api</artifactId>
<version>${vmlens.version}</version>
<scope>test</scope>
</dependency>

<!-- provided dependencies -->
<dependency>
Expand All @@ -412,4 +418,27 @@
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>com.vmlens</groupId>
<artifactId>vmlens-maven-plugin</artifactId>
<version>${vmlens.version}</version>
<executions>
<execution>
<id>test</id>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
<configuration>
<includes>
<include>**/*CT.java</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ public void unregisterStepsFromJob(String jobName) {
public Step getStep(String jobName, String stepName) throws NoSuchJobException {
Assert.notNull(jobName, "The job name cannot be null.");
Assert.notNull(stepName, "The step name cannot be null.");
if (!map.containsKey(jobName)) {
final Map<String, Step> jobSteps = map.get(jobName);
if (jobSteps == null) {
throw new NoSuchJobException("No job configuration with the name [" + jobName + "] was registered");
}
else {
final Map<String, Step> jobSteps = map.get(jobName);
if (jobSteps.containsKey(stepName)) {
return jobSteps.get(stepName);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* 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.
* You may obtain a copy of the License at
*
* https://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.batch.core.configuration.support;

import com.vmlens.api.AllInterleavings;
import org.junit.jupiter.api.Test;
import org.springframework.batch.core.configuration.DuplicateJobException;
import org.springframework.batch.core.configuration.StepRegistry;
import org.springframework.batch.core.launch.NoSuchJobException;
import org.springframework.batch.core.step.tasklet.TaskletStep;

import java.util.List;

/**
* @author Thomas Krieger
*/
public class MapStepRegistryCT {

@Test
public void unregisterAndGet() throws DuplicateJobException, InterruptedException {
try (AllInterleavings allInterleavings = new AllInterleavings("MapStepRegistryCT.unregisterAndGet")) {
while (allInterleavings.hasNext()) {
StepRegistry registry = new MapStepRegistry();
registry.register("foo", List.of(new TaskletStep("first")));
Thread first = new Thread() {
@Override
public void run() {
registry.unregisterStepsFromJob("foo");
}
};
first.start();
try {
registry.getStep("foo", "first");
}
catch (NoSuchJobException e) {

}
first.join();
}
}
}

}