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 @@ -3,6 +3,8 @@
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

import io.jenkins.plugins.casc.ConfigurationAsCode;
import io.jenkins.plugins.casc.ConfigurationContext;
Expand All @@ -16,7 +18,6 @@
import java.util.Date;
import java.util.List;
import org.jenkins.plugins.lockableresources.util.Constants;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

Expand All @@ -34,7 +35,7 @@ void setUp() {
@ConfiguredWithCode("configuration-as-code.yml")
void should_support_configuration_as_code(JenkinsConfiguredWithCodeRule r) {
LockableResourcesManager LRM = LockableResourcesManager.get();
Assertions.assertTrue(LRM.isAllowEmptyOrNullValues());
assertTrue(LRM.isAllowEmptyOrNullValues());

List<LockableResource> declaredResources = LRM.getDeclaredResources();
assertEquals(
Expand All @@ -47,7 +48,7 @@ void should_support_configuration_as_code(JenkinsConfiguredWithCodeRule r) {
assertEquals("Description_A", declaredResource.getDescription());
assertEquals("Label_A", declaredResource.getLabels());
// not supported in JCaC
assertEquals(null, declaredResource.getReservedBy());
assertNull(declaredResource.getReservedBy());
assertEquals("", declaredResource.getNote());

assertEquals(
Expand All @@ -58,7 +59,7 @@ void should_support_configuration_as_code(JenkinsConfiguredWithCodeRule r) {
assertEquals("Description_A", resource.getDescription());
assertEquals("Label_A", resource.getLabels());
// not supported in JCaC
assertEquals(null, declaredResource.getReservedBy());
assertNull(declaredResource.getReservedBy());
assertEquals("", declaredResource.getNote());
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.jenkins.plugins.lockableresources;

import static org.junit.Assert.assertFalse;
import static org.junit.jupiter.api.Assertions.assertFalse;

import hudson.model.FreeStyleBuild;
import hudson.model.FreeStyleProject;
Expand All @@ -11,20 +11,20 @@
import org.jenkinsci.plugins.workflow.job.WorkflowJob;
import org.jenkinsci.plugins.workflow.job.WorkflowRun;
import org.jenkinsci.plugins.workflow.test.steps.SemaphoreStep;
import org.junit.Rule;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.jvnet.hudson.test.JenkinsRule;
import org.jvnet.hudson.test.JenkinsSessionRule;
import org.jvnet.hudson.test.junit.jupiter.JenkinsSessionExtension;

public class LockStepWithRestartTest extends LockStepTestBase {
class LockStepWithRestartTest extends LockStepTestBase {

private static final Logger LOGGER = Logger.getLogger(LockStepTestBase.class.getName());

@Rule
public JenkinsSessionRule sessions = new JenkinsSessionRule();
@RegisterExtension
private final JenkinsSessionExtension sessions = new JenkinsSessionExtension();

@Test
public void lockOrderRestart() throws Throwable {
void lockOrderRestart() throws Throwable {
sessions.then(j -> {
LockableResourcesManager.get().createResource("resource1");
WorkflowJob p = j.jenkins.createProject(WorkflowJob.class, "p");
Expand Down Expand Up @@ -73,7 +73,7 @@ public void lockOrderRestart() throws Throwable {
}

@Test
public void interoperabilityOnRestart() throws Throwable {
void interoperabilityOnRestart() throws Throwable {
sessions.then(j -> {
LockableResourcesManager.get().createResource("resource1");
WorkflowJob p = j.jenkins.createProject(WorkflowJob.class, "p");
Expand Down Expand Up @@ -120,7 +120,7 @@ public void interoperabilityOnRestart() throws Throwable {
}

@Test
public void testReserveOverRestart() throws Throwable {
void testReserveOverRestart() throws Throwable {
sessions.then(j -> {
LockableResourcesManager manager = LockableResourcesManager.get();
manager.createResource("resource1");
Expand Down Expand Up @@ -163,7 +163,7 @@ public void testReserveOverRestart() throws Throwable {
}

@Test
public void checkQueueAfterRestart() throws Throwable {
void checkQueueAfterRestart() throws Throwable {
sessions.then(j -> {
LockableResourcesManager lrm = LockableResourcesManager.get();

Expand Down Expand Up @@ -206,7 +206,7 @@ public void checkQueueAfterRestart() throws Throwable {
}

@Test
public void chaosOnRestart() throws Throwable {
void chaosOnRestart() throws Throwable {
final int resourceCount = 50;
sessions.then(j -> {
for (int i = 1; i <= resourceCount; i++) {
Expand Down
Loading