1
0
mirror of synced 2026-05-22 13:23:17 +00:00

openrewrite Junit Migration

This commit is contained in:
Rob Winch
2021-07-08 14:52:28 -05:00
parent 8652f01269
commit 3e93b024d6
999 changed files with 3088 additions and 3092 deletions
@@ -18,8 +18,8 @@ package org.springframework.security.integration;
import javax.servlet.http.HttpSession;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mock.web.MockFilterChain;
@@ -31,12 +31,12 @@ import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.web.FilterChainProxy;
import org.springframework.security.web.context.HttpSessionSecurityContextRepository;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import static org.assertj.core.api.Assertions.assertThat;
@ContextConfiguration(locations = { "/http-extra-fsi-app-context.xml" })
@RunWith(SpringJUnit4ClassRunner.class)
@ExtendWith(SpringExtension.class)
public class HttpNamespaceWithMultipleInterceptorsTests {
@Autowired
@@ -18,8 +18,8 @@ package org.springframework.security.integration;
import javax.servlet.http.HttpSession;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mock.web.MockFilterChain;
@@ -32,12 +32,12 @@ import org.springframework.security.web.FilterChainProxy;
import org.springframework.security.web.context.HttpSessionSecurityContextRepository;
import org.springframework.security.web.firewall.RequestRejectedException;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
@ContextConfiguration(locations = { "/http-path-param-stripping-app-context.xml" })
@RunWith(SpringJUnit4ClassRunner.class)
@ExtendWith(SpringExtension.class)
public class HttpPathParameterStrippingTests {
@Autowired
@@ -16,10 +16,10 @@
package org.springframework.security.integration;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.AccessDeniedException;
@@ -29,7 +29,7 @@ import org.springframework.security.integration.multiannotation.MultiAnnotationS
import org.springframework.security.integration.multiannotation.PreAuthorizeService;
import org.springframework.security.integration.multiannotation.SecuredService;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
@@ -37,7 +37,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
* @author Luke Taylor
*/
@ContextConfiguration(locations = { "/multi-sec-annotation-app-context.xml" })
@RunWith(SpringJUnit4ClassRunner.class)
@ExtendWith(SpringExtension.class)
public class MultiAnnotationTests {
private final TestingAuthenticationToken joe_a = new TestingAuthenticationToken("joe", "pass", "ROLE_A");
@@ -53,8 +53,8 @@ public class MultiAnnotationTests {
@Autowired
SecuredService secService;
@After
@Before
@AfterEach
@BeforeEach
public void clearContext() {
SecurityContextHolder.clearContext();
}
@@ -16,18 +16,18 @@
package org.springframework.security.integration;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import static org.assertj.core.api.Assertions.assertThat;
@ContextConfiguration(locations = { "/sec-933-app-context.xml" })
@RunWith(SpringJUnit4ClassRunner.class)
@ExtendWith(SpringExtension.class)
public class SEC933ApplicationContextTests {
@Autowired
@@ -16,8 +16,8 @@
package org.springframework.security.integration;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.AccessDeniedException;
@@ -25,7 +25,7 @@ import org.springframework.security.authentication.UsernamePasswordAuthenticatio
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.session.SessionRegistry;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
@@ -34,7 +34,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
* @since 2.0
*/
@ContextConfiguration(locations = { "/sec-936-app-context.xml" })
@RunWith(SpringJUnit4ClassRunner.class)
@ExtendWith(SpringExtension.class)
public class SEC936ApplicationContextTests {
/**
@@ -16,17 +16,17 @@
package org.springframework.security.integration.python;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit.jupiter.SpringExtension;
@ContextConfiguration(locations = { "/python-method-access-app-context.xml" })
@RunWith(SpringJUnit4ClassRunner.class)
@ExtendWith(SpringExtension.class)
public class PythonInterpreterBasedSecurityTests {
@Autowired
@@ -21,11 +21,11 @@ import java.util.List;
import javax.servlet.http.HttpSession;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
@@ -40,7 +40,7 @@ import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.web.FilterChainProxy;
import org.springframework.security.web.context.HttpSessionSecurityContextRepository;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.util.StopWatch;
/**
@@ -48,7 +48,7 @@ import org.springframework.util.StopWatch;
* @since 2.0
*/
@ContextConfiguration(locations = { "/filter-chain-performance-app-context.xml" })
@RunWith(SpringJUnit4ClassRunner.class)
@ExtendWith(SpringExtension.class)
public class FilterChainPerformanceTests {
// Adjust as required
@@ -71,7 +71,7 @@ public class FilterChainPerformanceTests {
@Qualifier("fcpFullStack")
private FilterChainProxy fullStack;
@Before
@BeforeEach
public void createAuthenticatedSession() {
this.session = new MockHttpSession();
SecurityContextHolder.getContext().setAuthentication(this.user);
@@ -80,12 +80,12 @@ public class FilterChainPerformanceTests {
SecurityContextHolder.clearContext();
}
@After
@AfterEach
public void clearContext() {
SecurityContextHolder.clearContext();
}
@AfterClass
@AfterAll
public static void dumpStopWatch() {
System.out.println(sw.prettyPrint());
}
@@ -16,9 +16,9 @@
package org.springframework.security.performance;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
@@ -27,7 +27,7 @@ import org.springframework.security.authentication.AuthenticationCredentialsNotF
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.session.SessionRegistry;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.util.StopWatch;
import static org.assertj.core.api.Assertions.fail;
@@ -36,12 +36,12 @@ import static org.assertj.core.api.Assertions.fail;
* @author Luke Taylor
*/
@ContextConfiguration(locations = { "/protect-pointcut-performance-app-context.xml" })
@RunWith(SpringJUnit4ClassRunner.class)
@ExtendWith(SpringExtension.class)
public class ProtectPointcutPerformanceTests implements ApplicationContextAware {
ApplicationContext ctx;
@Before
@BeforeEach
public void clearContext() {
SecurityContextHolder.clearContext();
}
@@ -16,9 +16,9 @@
package org.springframework.security;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.security.config.BeanIds;
@@ -33,12 +33,12 @@ public class LdapServerBeanDefinitionParserTests {
private ClassPathXmlApplicationContext context;
@Before
@BeforeEach
public void setup() {
this.context = new ClassPathXmlApplicationContext("applicationContext-security.xml");
}
@After
@AfterEach
public void closeAppContext() {
if (this.context != null) {
this.context.close();
@@ -16,9 +16,9 @@
package org.springframework.security;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.security.config.BeanIds;
@@ -33,12 +33,12 @@ public class LdapServerBeanDefinitionParserTests {
private ClassPathXmlApplicationContext context;
@Before
@BeforeEach
public void setup() {
this.context = new ClassPathXmlApplicationContext("applicationContext-security.xml");
}
@After
@AfterEach
public void closeAppContext() {
if (this.context != null) {
this.context.close();
@@ -16,9 +16,9 @@
package org.springframework.security;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.security.config.BeanIds;
@@ -33,12 +33,12 @@ public class LdapServerBeanDefinitionParserTests {
private ClassPathXmlApplicationContext context;
@Before
@BeforeEach
public void setup() {
this.context = new ClassPathXmlApplicationContext("applicationContext-security.xml");
}
@After
@AfterEach
public void closeAppContext() {
if (this.context != null) {
this.context.close();
@@ -16,8 +16,8 @@
package org.springframework.security;
import org.junit.After;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.BeanDefinitionStoreException;
import org.springframework.context.support.ClassPathXmlApplicationContext;
@@ -31,7 +31,7 @@ public class LdapServerBeanDefinitionParserTests {
private ClassPathXmlApplicationContext context;
@After
@AfterEach
public void closeAppContext() {
if (this.context != null) {
this.context.close();
@@ -16,9 +16,9 @@
package org.springframework.security;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.security.config.BeanIds;
@@ -33,12 +33,12 @@ public class LdapServerBeanDefinitionParserTests {
private ClassPathXmlApplicationContext context;
@Before
@BeforeEach
public void setup() {
this.context = new ClassPathXmlApplicationContext("applicationContext-security.xml");
}
@After
@AfterEach
public void closeAppContext() {
if (this.context != null) {
this.context.close();
@@ -16,7 +16,7 @@
package org.springframework.security.integration;
import org.junit.After;
import org.junit.jupiter.api.AfterEach;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.mock.web.MockServletContext;
@@ -38,7 +38,7 @@ public abstract class AbstractWebServerIntegrationTests {
protected ConfigurableApplicationContext context;
@After
@AfterEach
public void close() {
if (this.context != null) {
this.context.close();
@@ -16,7 +16,7 @@
package org.springframework.security.integration;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;
@@ -19,7 +19,7 @@ package org.springframework.security.integration;
import java.util.Collections;
import java.util.List;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.mock.web.MockHttpSession;
import org.springframework.security.core.context.SecurityContext;