SEC-2684: Correct spelling of WithSecurityContextTestExecutionListener
This commit is contained in:
parent
75df42cb7c
commit
906a0cb0e2
|
@ -29,7 +29,7 @@ import org.junit.runner.RunWith;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.samples.mvc.config.WebMvcConfiguration;
|
||||
import org.springframework.security.test.context.support.WithMockUser;
|
||||
import org.springframework.security.test.context.support.WithSecurityContextTestExcecutionListener;
|
||||
import org.springframework.security.test.context.support.WithSecurityContextTestExecutionListener;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.TestExecutionListeners;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
@ -54,7 +54,7 @@ import org.springframework.web.context.WebApplicationContext;
|
|||
DependencyInjectionTestExecutionListener.class,
|
||||
DirtiesContextTestExecutionListener.class,
|
||||
TransactionalTestExecutionListener.class,
|
||||
WithSecurityContextTestExcecutionListener.class})
|
||||
WithSecurityContextTestExecutionListener.class})
|
||||
public class SecurityConfigTests {
|
||||
private MockMvc mvc;
|
||||
|
||||
|
|
|
@ -30,17 +30,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.security.samples.mvc.config.WebMvcConfiguration;
|
||||
import org.springframework.security.test.context.DefaultSecurityTestExecutionListeners;
|
||||
import org.springframework.security.test.context.support.WithMockUser;
|
||||
import org.springframework.security.test.context.support.WithSecurityContextTestExcecutionListener;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.TestExecutionListeners;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.test.context.support.DependencyInjectionTestExecutionListener;
|
||||
import org.springframework.test.context.support.DirtiesContextTestExecutionListener;
|
||||
import org.springframework.test.context.transaction.TransactionalTestExecutionListener;
|
||||
import org.springframework.test.context.web.ServletTestExecutionListener;
|
||||
import org.springframework.test.context.web.WebAppConfiguration;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;
|
||||
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
||||
import org.springframework.web.context.WebApplicationContext;
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
package org.springframework.security.test.context;
|
||||
|
||||
import org.springframework.security.test.context.support.WithSecurityContextTestExcecutionListener;
|
||||
import org.springframework.security.test.context.support.WithSecurityContextTestExecutionListener;
|
||||
import org.springframework.test.context.TestExecutionListeners;
|
||||
import org.springframework.test.context.support.DependencyInjectionTestExecutionListener;
|
||||
import org.springframework.test.context.support.DirtiesContextTestExecutionListener;
|
||||
|
@ -38,5 +38,5 @@ import java.lang.annotation.*;
|
|||
DependencyInjectionTestExecutionListener.class,
|
||||
DirtiesContextTestExecutionListener.class,
|
||||
TransactionalTestExecutionListener.class,
|
||||
WithSecurityContextTestExcecutionListener.class})
|
||||
WithSecurityContextTestExecutionListener.class})
|
||||
public @interface DefaultSecurityTestExecutionListeners {}
|
|
@ -19,7 +19,6 @@ import javax.servlet.FilterChain;
|
|||
|
||||
import org.springframework.security.core.context.SecurityContext;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.security.test.context.support.WithSecurityContextTestExcecutionListener;
|
||||
import org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors;
|
||||
import org.springframework.security.web.context.SecurityContextPersistenceFilter;
|
||||
import org.springframework.security.web.context.SecurityContextRepository;
|
||||
|
@ -43,7 +42,7 @@ import org.springframework.util.Assert;
|
|||
* <ul>
|
||||
* <li>Before a test is executed, the {@link TestSecurityContextHolder} is
|
||||
* populated. Typically this is done using the
|
||||
* {@link WithSecurityContextTestExcecutionListener}</li>
|
||||
* {@link org.springframework.security.test.context.support.WithSecurityContextTestExecutionListener}</li>
|
||||
* <li>The test is ran. When used with {@link MockMvc} it is typically used with
|
||||
* {@link SecurityMockMvcRequestPostProcessors#testSecurityContext()}. Which ensures
|
||||
* the {@link SecurityContext} from {@link TestSecurityContextHolder} is
|
||||
|
|
|
@ -29,7 +29,7 @@ import org.springframework.security.core.context.SecurityContextHolder;
|
|||
import org.springframework.test.web.servlet.MockMvc;
|
||||
|
||||
/**
|
||||
* When used with {@link WithSecurityContextTestExcecutionListener} this annotation can be
|
||||
* When used with {@link WithSecurityContextTestExecutionListener} this annotation can be
|
||||
* added to a test method to emulate running with a mocked user. In order to work with {@link MockMvc} The
|
||||
* {@link SecurityContext} that is used will have the following properties:
|
||||
*
|
||||
|
|
|
@ -39,7 +39,7 @@ import org.springframework.test.web.servlet.MockMvc;
|
|||
* @author Rob Winch
|
||||
* @since 4.0
|
||||
*/
|
||||
public class WithSecurityContextTestExcecutionListener extends
|
||||
public class WithSecurityContextTestExecutionListener extends
|
||||
AbstractTestExecutionListener {
|
||||
|
||||
/**
|
|
@ -31,7 +31,7 @@ import org.springframework.security.core.userdetails.UserDetailsService;
|
|||
import org.springframework.test.web.servlet.MockMvc;
|
||||
|
||||
/**
|
||||
* When used with {@link WithSecurityContextTestExcecutionListener} this annotation can be
|
||||
* When used with {@link WithSecurityContextTestExecutionListener} this annotation can be
|
||||
* added to a test method to emulate running with a {@link UserDetails} returned
|
||||
* from the {@link UserDetailsService}. In order to work with {@link MockMvc}
|
||||
* The {@link SecurityContext} that is used will have the following properties:
|
||||
|
|
|
@ -37,11 +37,11 @@ public class WithSecurityContextTestExcecutionListenerTests {
|
|||
@Mock
|
||||
private TestContext testContext;
|
||||
|
||||
private WithSecurityContextTestExcecutionListener listener;
|
||||
private WithSecurityContextTestExecutionListener listener;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
listener = new WithSecurityContextTestExcecutionListener();
|
||||
listener = new WithSecurityContextTestExecutionListener();
|
||||
context = new AnnotationConfigApplicationContext(Config.class);
|
||||
}
|
||||
|
||||
|
|
|
@ -35,14 +35,8 @@ import org.springframework.security.config.annotation.web.servlet.configuration.
|
|||
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
import org.springframework.security.test.context.DefaultSecurityTestExecutionListeners;
|
||||
import org.springframework.security.test.context.support.WithUserDetails;
|
||||
import org.springframework.security.test.context.support.WithSecurityContextTestExcecutionListener;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.TestExecutionListeners;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.test.context.support.DependencyInjectionTestExecutionListener;
|
||||
import org.springframework.test.context.support.DirtiesContextTestExecutionListener;
|
||||
import org.springframework.test.context.transaction.TransactionalTestExecutionListener;
|
||||
import org.springframework.test.context.web.ServletTestExecutionListener;
|
||||
import org.springframework.test.context.web.WebAppConfiguration;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
||||
|
|
Loading…
Reference in New Issue