Skip to content
Snippets Groups Projects
Commit e86eb913 authored by Daniel Gerhardt's avatar Daniel Gerhardt Committed by Daniel Gerhardt
Browse files

Fix configuration for testing

parent 845c784c
Branches
Tags
No related merge requests found
Showing
with 63 additions and 30 deletions
package de.thm.arsnova.config; package de.thm.arsnova.config;
import javax.servlet.ServletContext;
import org.jasig.cas.client.validation.Cas20ProxyTicketValidator; import org.jasig.cas.client.validation.Cas20ProxyTicketValidator;
import org.scribe.up.provider.impl.FacebookProvider; import org.scribe.up.provider.impl.FacebookProvider;
import org.scribe.up.provider.impl.Google2Provider; import org.scribe.up.provider.impl.Google2Provider;
import org.scribe.up.provider.impl.Google2Provider.Google2Scope; import org.scribe.up.provider.impl.Google2Provider.Google2Scope;
import org.scribe.up.provider.impl.TwitterProvider; import org.scribe.up.provider.impl.TwitterProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.FileSystemResource; import org.springframework.core.io.FileSystemResource;
...@@ -40,6 +45,7 @@ import org.springframework.security.web.authentication.logout.LogoutFilter; ...@@ -40,6 +45,7 @@ import org.springframework.security.web.authentication.logout.LogoutFilter;
import org.springframework.security.web.authentication.logout.LogoutSuccessHandler; import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;
import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler; import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher; import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
import org.springframework.web.context.ServletContextAware;
import com.github.leleuj.ss.oauth.client.authentication.OAuthAuthenticationProvider; import com.github.leleuj.ss.oauth.client.authentication.OAuthAuthenticationProvider;
import com.github.leleuj.ss.oauth.client.web.OAuthAuthenticationEntryPoint; import com.github.leleuj.ss.oauth.client.web.OAuthAuthenticationEntryPoint;
...@@ -54,9 +60,10 @@ import de.thm.arsnova.security.DbUserDetailsService; ...@@ -54,9 +60,10 @@ import de.thm.arsnova.security.DbUserDetailsService;
@Configuration @Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true) @EnableGlobalMethodSecurity(prePostEnabled = true)
@EnableWebSecurity @EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter { public class SecurityConfig extends WebSecurityConfigurerAdapter implements ServletContextAware {
private ServletContext servletContext;
@Value("${root-url}") private String rootUrl; @Value("${root-url}") private String rootUrl;
@Value("#{servletContext.contextPath}") private String contextPath;
@Value("${security.user-db.enabled}") private boolean dbAuthEnabled; @Value("${security.user-db.enabled}") private boolean dbAuthEnabled;
...@@ -194,11 +201,13 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -194,11 +201,13 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
// LDAP Authentication Configuration // LDAP Authentication Configuration
@Profile("!test")
@Bean @Bean
public LdapAuthenticationProvider ldapAuthenticationProvider() throws Exception { public LdapAuthenticationProvider ldapAuthenticationProvider() throws Exception {
return new LdapAuthenticationProvider(ldapAuthenticator(), ldapAuthoritiesPopulator()); return new LdapAuthenticationProvider(ldapAuthenticator(), ldapAuthoritiesPopulator());
} }
@Profile("!test")
@Bean @Bean
public LdapContextSource ldapContextSource() throws Exception { public LdapContextSource ldapContextSource() throws Exception {
DefaultSpringSecurityContextSource contextSource = new DefaultSpringSecurityContextSource(ldapUrl); DefaultSpringSecurityContextSource contextSource = new DefaultSpringSecurityContextSource(ldapUrl);
...@@ -209,6 +218,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -209,6 +218,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
return contextSource; return contextSource;
} }
@Profile("!test")
@Bean @Bean
public LdapAuthenticator ldapAuthenticator() throws Exception { public LdapAuthenticator ldapAuthenticator() throws Exception {
BindAuthenticator authenticator = new BindAuthenticator(ldapContextSource()); BindAuthenticator authenticator = new BindAuthenticator(ldapContextSource());
...@@ -217,6 +227,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -217,6 +227,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
return authenticator; return authenticator;
} }
@Profile("!test")
@Bean @Bean
public LdapAuthoritiesPopulator ldapAuthoritiesPopulator() throws Exception { public LdapAuthoritiesPopulator ldapAuthoritiesPopulator() throws Exception {
return new DefaultLdapAuthoritiesPopulator(ldapContextSource(), null); return new DefaultLdapAuthoritiesPopulator(ldapContextSource(), null);
...@@ -224,6 +235,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -224,6 +235,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
// CAS Authentication Configuration // CAS Authentication Configuration
@Profile("!test")
@Bean @Bean
public CasAuthenticationProvider casAuthenticationProvider() { public CasAuthenticationProvider casAuthenticationProvider() {
CasAuthenticationProvider authProvider = new CasAuthenticationProvider(); CasAuthenticationProvider authProvider = new CasAuthenticationProvider();
...@@ -235,25 +247,29 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -235,25 +247,29 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
return authProvider; return authProvider;
} }
@Profile("!test")
@Bean @Bean
public CasUserDetailsService casUserDetailsService() { public CasUserDetailsService casUserDetailsService() {
return new CasUserDetailsService(); return new CasUserDetailsService();
} }
@Profile("!test")
@Bean @Bean
public ServiceProperties casServiceProperties() { public ServiceProperties casServiceProperties() {
ServiceProperties properties = new ServiceProperties(); ServiceProperties properties = new ServiceProperties();
properties.setService(rootUrl + contextPath + "/j_spring_cas_security_check"); properties.setService(rootUrl + servletContext.getContextPath() + "/j_spring_cas_security_check");
properties.setSendRenew(false); properties.setSendRenew(false);
return properties; return properties;
} }
@Profile("!test")
@Bean @Bean
public Cas20ProxyTicketValidator casTicketValidator() { public Cas20ProxyTicketValidator casTicketValidator() {
return new Cas20ProxyTicketValidator(casUrl); return new Cas20ProxyTicketValidator(casUrl);
} }
@Profile("!test")
@Bean @Bean
public CasAuthenticationEntryPoint casAuthenticationEntryPoint() { public CasAuthenticationEntryPoint casAuthenticationEntryPoint() {
CasAuthenticationEntryPoint entryPoint = new CasAuthenticationEntryPoint(); CasAuthenticationEntryPoint entryPoint = new CasAuthenticationEntryPoint();
...@@ -263,6 +279,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -263,6 +279,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
return entryPoint; return entryPoint;
} }
@Profile("!test")
@Bean @Bean
public CasAuthenticationFilter casAuthenticationFilter() throws Exception { public CasAuthenticationFilter casAuthenticationFilter() throws Exception {
CasAuthenticationFilter filter = new CasAuthenticationFilter(); CasAuthenticationFilter filter = new CasAuthenticationFilter();
...@@ -273,6 +290,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -273,6 +290,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
return filter; return filter;
} }
@Profile("!test")
@Bean @Bean
public LogoutFilter casLogoutFilter() { public LogoutFilter casLogoutFilter() {
LogoutFilter filter = new LogoutFilter(casLogoutSuccessHandler(), logoutHandler()); LogoutFilter filter = new LogoutFilter(casLogoutSuccessHandler(), logoutHandler());
...@@ -281,6 +299,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -281,6 +299,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
return filter; return filter;
} }
@Profile("!test")
@Bean @Bean
public LogoutSuccessHandler casLogoutSuccessHandler() { public LogoutSuccessHandler casLogoutSuccessHandler() {
CASLogoutSuccessHandler handler = new CASLogoutSuccessHandler(); CASLogoutSuccessHandler handler = new CASLogoutSuccessHandler();
...@@ -292,6 +311,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -292,6 +311,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
// Facebook Authentication Configuration // Facebook Authentication Configuration
@Profile("!test")
@Bean @Bean
public OAuthAuthenticationEntryPoint facebookEntryPoint() { public OAuthAuthenticationEntryPoint facebookEntryPoint() {
final OAuthAuthenticationEntryPoint entryPoint = new OAuthAuthenticationEntryPoint(); final OAuthAuthenticationEntryPoint entryPoint = new OAuthAuthenticationEntryPoint();
...@@ -300,16 +320,18 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -300,16 +320,18 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
return entryPoint; return entryPoint;
} }
@Profile("!test")
@Bean @Bean
public FacebookProvider facebookProvider() { public FacebookProvider facebookProvider() {
final FacebookProvider provider = new FacebookProvider(); final FacebookProvider provider = new FacebookProvider();
provider.setKey(facebookKey); provider.setKey(facebookKey);
provider.setSecret(facebookSecret); provider.setSecret(facebookSecret);
provider.setCallbackUrl(rootUrl + contextPath + "/j_spring_facebook_security_check"); provider.setCallbackUrl(rootUrl + servletContext.getContextPath() + "/j_spring_facebook_security_check");
return provider; return provider;
} }
@Profile("!test")
@Bean @Bean
public OAuthAuthenticationFilter facebookFilter() throws Exception { public OAuthAuthenticationFilter facebookFilter() throws Exception {
final OAuthAuthenticationFilter filter = new OAuthAuthenticationFilter("/j_spring_facebook_security_check"); final OAuthAuthenticationFilter filter = new OAuthAuthenticationFilter("/j_spring_facebook_security_check");
...@@ -321,6 +343,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -321,6 +343,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
return filter; return filter;
} }
@Profile("!test")
@Bean @Bean
public OAuthAuthenticationProvider facebookAuthProvider() { public OAuthAuthenticationProvider facebookAuthProvider() {
final OAuthAuthenticationProvider authProvider = new OAuthAuthenticationProvider(); final OAuthAuthenticationProvider authProvider = new OAuthAuthenticationProvider();
...@@ -331,16 +354,18 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -331,16 +354,18 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
// Twitter Authentication Configuration // Twitter Authentication Configuration
@Profile("!test")
@Bean @Bean
public TwitterProvider twitterProvider() { public TwitterProvider twitterProvider() {
final TwitterProvider provider = new TwitterProvider(); final TwitterProvider provider = new TwitterProvider();
provider.setKey(twitterKey); provider.setKey(twitterKey);
provider.setSecret(twitterSecret); provider.setSecret(twitterSecret);
provider.setCallbackUrl(rootUrl + contextPath + "/j_spring_twitter_security_check"); provider.setCallbackUrl(rootUrl + servletContext.getContextPath() + "/j_spring_twitter_security_check");
return provider; return provider;
} }
@Profile("!test")
@Bean @Bean
public OAuthAuthenticationFilter twitterFilter() throws Exception { public OAuthAuthenticationFilter twitterFilter() throws Exception {
final OAuthAuthenticationFilter filter = new OAuthAuthenticationFilter("/j_spring_twitter_security_check"); final OAuthAuthenticationFilter filter = new OAuthAuthenticationFilter("/j_spring_twitter_security_check");
...@@ -351,6 +376,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -351,6 +376,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
return filter; return filter;
} }
@Profile("!test")
@Bean @Bean
public OAuthAuthenticationProvider twitterAuthProvider() { public OAuthAuthenticationProvider twitterAuthProvider() {
final OAuthAuthenticationProvider authProvider = new OAuthAuthenticationProvider(); final OAuthAuthenticationProvider authProvider = new OAuthAuthenticationProvider();
...@@ -361,17 +387,19 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -361,17 +387,19 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
// Google Authentication Configuration // Google Authentication Configuration
@Profile("!test")
@Bean @Bean
public Google2Provider googleProvider() { public Google2Provider googleProvider() {
final Google2Provider provider = new Google2Provider(); final Google2Provider provider = new Google2Provider();
provider.setKey(googleKey); provider.setKey(googleKey);
provider.setSecret(googleSecret); provider.setSecret(googleSecret);
provider.setCallbackUrl(rootUrl + contextPath + "/j_spring_google_security_check"); provider.setCallbackUrl(rootUrl + servletContext.getContextPath() + "/j_spring_google_security_check");
provider.setScope(Google2Scope.EMAIL); provider.setScope(Google2Scope.EMAIL);
return provider; return provider;
} }
@Profile("!test")
@Bean @Bean
public OAuthAuthenticationFilter googleFilter() throws Exception { public OAuthAuthenticationFilter googleFilter() throws Exception {
final OAuthAuthenticationFilter filter = new OAuthAuthenticationFilter("/j_spring_google_security_check"); final OAuthAuthenticationFilter filter = new OAuthAuthenticationFilter("/j_spring_google_security_check");
...@@ -383,6 +411,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -383,6 +411,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
return filter; return filter;
} }
@Profile("!test")
@Bean @Bean
public OAuthAuthenticationProvider googleAuthProvider() { public OAuthAuthenticationProvider googleAuthProvider() {
final OAuthAuthenticationProvider authProvider = new OAuthAuthenticationProvider(); final OAuthAuthenticationProvider authProvider = new OAuthAuthenticationProvider();
...@@ -390,4 +419,9 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -390,4 +419,9 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
return authProvider; return authProvider;
} }
@Override
public void setServletContext(ServletContext servletContext) {
this.servletContext = servletContext;
}
} }
...@@ -147,7 +147,7 @@ public class LoginController extends AbstractController { ...@@ -147,7 +147,7 @@ public class LoginController extends AbstractController {
@Autowired(required = false) @Autowired(required = false)
private FacebookProvider facebookProvider; private FacebookProvider facebookProvider;
@Autowired(required = false) @Autowired(required = false)
private LdapAuthenticationProvider ldapAuthenticationProvider; private LdapAuthenticationProvider ldapAuthenticationProvider;
......
...@@ -15,14 +15,14 @@ ...@@ -15,14 +15,14 @@
<context:component-scan base-package="de.thm.arsnova.controller,de.thm.arsnova.web" /> <context:component-scan base-package="de.thm.arsnova.controller,de.thm.arsnova.web" />
<context:property-placeholder location="file:///etc/arsnova/arsnova.properties" file-encoding="UTF-8" /> <context:property-placeholder location="file:///etc/arsnova/arsnova.properties" file-encoding="UTF-8" />
<mvc:annotation-driven <mvc:annotation-driven
content-negotiation-manager="contentNegotiationManager" /> content-negotiation-manager="mvcContentNegotiationManager" />
<mvc:interceptors> <mvc:interceptors>
<bean class="de.thm.arsnova.web.CacheControlInterceptorHandler" /> <bean class="de.thm.arsnova.web.CacheControlInterceptorHandler" />
<bean class="de.thm.arsnova.web.DeprecatedApiInterceptorHandler" /> <bean class="de.thm.arsnova.web.DeprecatedApiInterceptorHandler" />
</mvc:interceptors> </mvc:interceptors>
<bean id="contentNegotiationManager" <bean id="mvcContentNegotiationManager"
class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean"> class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean">
<property name="favorPathExtension" value="false" /> <property name="favorPathExtension" value="false" />
<property name="favorParameter" value="true" /> <property name="favorParameter" value="true" />
......
...@@ -5,6 +5,7 @@ import static org.junit.Assert.assertNull; ...@@ -5,6 +5,7 @@ import static org.junit.Assert.assertNull;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.context.web.WebAppConfiguration;
...@@ -16,10 +17,10 @@ import de.thm.arsnova.connector.client.ConnectorClient; ...@@ -16,10 +17,10 @@ import de.thm.arsnova.connector.client.ConnectorClient;
@ContextConfiguration(locations = { @ContextConfiguration(locations = {
"file:src/main/webapp/WEB-INF/spring/arsnova-servlet.xml", "file:src/main/webapp/WEB-INF/spring/arsnova-servlet.xml",
"file:src/main/webapp/WEB-INF/spring/spring-main.xml", "file:src/main/webapp/WEB-INF/spring/spring-main.xml",
"file:src/main/webapp/WEB-INF/spring/spring-security.xml",
"file:src/test/resources/test-config.xml", "file:src/test/resources/test-config.xml",
"file:src/test/resources/test-socketioconfig.xml" "file:src/test/resources/test-socketioconfig.xml"
}) })
@ActiveProfiles("test")
public class ExtraConfigTest { public class ExtraConfigTest {
@Autowired(required = false) @Autowired(required = false)
......
...@@ -16,6 +16,7 @@ import org.springframework.http.MediaType; ...@@ -16,6 +16,7 @@ import org.springframework.http.MediaType;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.context.web.WebAppConfiguration;
...@@ -31,10 +32,11 @@ import de.thm.arsnova.services.StubUserService; ...@@ -31,10 +32,11 @@ import de.thm.arsnova.services.StubUserService;
@ContextConfiguration(locations = { @ContextConfiguration(locations = {
"file:src/main/webapp/WEB-INF/spring/arsnova-servlet.xml", "file:src/main/webapp/WEB-INF/spring/arsnova-servlet.xml",
"file:src/main/webapp/WEB-INF/spring/spring-main.xml", "file:src/main/webapp/WEB-INF/spring/spring-main.xml",
"file:src/main/webapp/WEB-INF/spring/spring-security.xml",
"file:src/test/resources/test-config.xml", "file:src/test/resources/test-config.xml",
"file:src/test/resources/test-socketioconfig.xml" "file:src/test/resources/test-socketioconfig.xml"
}) })
@ActiveProfiles("test")
public class CourseControllerTest { public class CourseControllerTest {
private MockMvc mockMvc; private MockMvc mockMvc;
......
...@@ -11,6 +11,7 @@ import org.junit.Test; ...@@ -11,6 +11,7 @@ import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.context.web.WebAppConfiguration;
...@@ -25,10 +26,10 @@ import de.thm.arsnova.services.StubUserService; ...@@ -25,10 +26,10 @@ import de.thm.arsnova.services.StubUserService;
@ContextConfiguration(locations = { @ContextConfiguration(locations = {
"file:src/main/webapp/WEB-INF/spring/arsnova-servlet.xml", "file:src/main/webapp/WEB-INF/spring/arsnova-servlet.xml",
"file:src/main/webapp/WEB-INF/spring/spring-main.xml", "file:src/main/webapp/WEB-INF/spring/spring-main.xml",
"file:src/main/webapp/WEB-INF/spring/spring-security.xml",
"file:src/test/resources/test-config.xml", "file:src/test/resources/test-config.xml",
"file:src/test/resources/test-socketioconfig.xml" "file:src/test/resources/test-socketioconfig.xml"
}) })
@ActiveProfiles("test")
public class FeedbackControllerTest { public class FeedbackControllerTest {
@Autowired @Autowired
......
...@@ -17,6 +17,7 @@ import org.springframework.http.MediaType; ...@@ -17,6 +17,7 @@ import org.springframework.http.MediaType;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.context.web.WebAppConfiguration;
...@@ -31,10 +32,10 @@ import de.thm.arsnova.services.StubUserService; ...@@ -31,10 +32,10 @@ import de.thm.arsnova.services.StubUserService;
@ContextConfiguration(locations = { @ContextConfiguration(locations = {
"file:src/main/webapp/WEB-INF/spring/arsnova-servlet.xml", "file:src/main/webapp/WEB-INF/spring/arsnova-servlet.xml",
"file:src/main/webapp/WEB-INF/spring/spring-main.xml", "file:src/main/webapp/WEB-INF/spring/spring-main.xml",
"file:src/main/webapp/WEB-INF/spring/spring-security.xml",
"file:src/test/resources/test-config.xml", "file:src/test/resources/test-config.xml",
"file:src/test/resources/test-socketioconfig.xml" "file:src/test/resources/test-socketioconfig.xml"
}) })
@ActiveProfiles("test")
public class LecturerQuestionControllerTest { public class LecturerQuestionControllerTest {
@Autowired @Autowired
......
...@@ -33,6 +33,7 @@ import org.springframework.http.MediaType; ...@@ -33,6 +33,7 @@ import org.springframework.http.MediaType;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication; import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.context.web.WebAppConfiguration;
...@@ -47,10 +48,10 @@ import de.thm.arsnova.services.StubUserService; ...@@ -47,10 +48,10 @@ import de.thm.arsnova.services.StubUserService;
@ContextConfiguration(locations = { @ContextConfiguration(locations = {
"file:src/main/webapp/WEB-INF/spring/arsnova-servlet.xml", "file:src/main/webapp/WEB-INF/spring/arsnova-servlet.xml",
"file:src/main/webapp/WEB-INF/spring/spring-main.xml", "file:src/main/webapp/WEB-INF/spring/spring-main.xml",
"file:src/main/webapp/WEB-INF/spring/spring-security.xml",
"file:src/test/resources/test-config.xml", "file:src/test/resources/test-config.xml",
"file:src/test/resources/test-socketioconfig.xml" "file:src/test/resources/test-socketioconfig.xml"
}) })
@ActiveProfiles("test")
public class LoginControllerTest { public class LoginControllerTest {
@Autowired @Autowired
......
...@@ -18,6 +18,7 @@ import org.springframework.http.MediaType; ...@@ -18,6 +18,7 @@ import org.springframework.http.MediaType;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.context.web.WebAppConfiguration;
...@@ -32,10 +33,10 @@ import de.thm.arsnova.services.StubUserService; ...@@ -32,10 +33,10 @@ import de.thm.arsnova.services.StubUserService;
@ContextConfiguration(locations = { @ContextConfiguration(locations = {
"file:src/main/webapp/WEB-INF/spring/arsnova-servlet.xml", "file:src/main/webapp/WEB-INF/spring/arsnova-servlet.xml",
"file:src/main/webapp/WEB-INF/spring/spring-main.xml", "file:src/main/webapp/WEB-INF/spring/spring-main.xml",
"file:src/main/webapp/WEB-INF/spring/spring-security.xml",
"file:src/test/resources/test-config.xml", "file:src/test/resources/test-config.xml",
"file:src/test/resources/test-socketioconfig.xml" "file:src/test/resources/test-socketioconfig.xml"
}) })
@ActiveProfiles("test")
public class SessionControllerTest { public class SessionControllerTest {
@Autowired @Autowired
......
...@@ -11,6 +11,7 @@ import org.junit.Test; ...@@ -11,6 +11,7 @@ import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.context.web.WebAppConfiguration;
...@@ -23,10 +24,10 @@ import org.springframework.web.context.WebApplicationContext; ...@@ -23,10 +24,10 @@ import org.springframework.web.context.WebApplicationContext;
@ContextConfiguration(locations = { @ContextConfiguration(locations = {
"file:src/main/webapp/WEB-INF/spring/arsnova-servlet.xml", "file:src/main/webapp/WEB-INF/spring/arsnova-servlet.xml",
"file:src/main/webapp/WEB-INF/spring/spring-main.xml", "file:src/main/webapp/WEB-INF/spring/spring-main.xml",
"file:src/main/webapp/WEB-INF/spring/spring-security.xml",
"file:src/test/resources/test-config.xml", "file:src/test/resources/test-config.xml",
"file:src/test/resources/test-socketioconfig.xml" "file:src/test/resources/test-socketioconfig.xml"
}) })
@ActiveProfiles("test")
public class StatisticsControllerTest { public class StatisticsControllerTest {
@Autowired @Autowired
......
...@@ -40,7 +40,6 @@ import de.thm.arsnova.exceptions.NotFoundException; ...@@ -40,7 +40,6 @@ import de.thm.arsnova.exceptions.NotFoundException;
@ContextConfiguration(locations = { @ContextConfiguration(locations = {
"file:src/main/webapp/WEB-INF/spring/arsnova-servlet.xml", "file:src/main/webapp/WEB-INF/spring/arsnova-servlet.xml",
"file:src/main/webapp/WEB-INF/spring/spring-main.xml", "file:src/main/webapp/WEB-INF/spring/spring-main.xml",
"file:src/main/webapp/WEB-INF/spring/spring-security.xml",
"file:src/test/resources/test-config.xml" "file:src/test/resources/test-config.xml"
}) })
@ActiveProfiles("test") @ActiveProfiles("test")
......
...@@ -48,7 +48,6 @@ import de.thm.arsnova.exceptions.NotFoundException; ...@@ -48,7 +48,6 @@ import de.thm.arsnova.exceptions.NotFoundException;
@ContextConfiguration(locations = { @ContextConfiguration(locations = {
"file:src/main/webapp/WEB-INF/spring/arsnova-servlet.xml", "file:src/main/webapp/WEB-INF/spring/arsnova-servlet.xml",
"file:src/main/webapp/WEB-INF/spring/spring-main.xml", "file:src/main/webapp/WEB-INF/spring/spring-main.xml",
"file:src/main/webapp/WEB-INF/spring/spring-security.xml",
"file:src/test/resources/test-config.xml" "file:src/test/resources/test-config.xml"
}) })
@ActiveProfiles("test") @ActiveProfiles("test")
......
...@@ -58,7 +58,6 @@ import de.thm.arsnova.exceptions.NotFoundException; ...@@ -58,7 +58,6 @@ import de.thm.arsnova.exceptions.NotFoundException;
@ContextConfiguration(locations = { @ContextConfiguration(locations = {
"file:src/main/webapp/WEB-INF/spring/arsnova-servlet.xml", "file:src/main/webapp/WEB-INF/spring/arsnova-servlet.xml",
"file:src/main/webapp/WEB-INF/spring/spring-main.xml", "file:src/main/webapp/WEB-INF/spring/spring-main.xml",
"file:src/main/webapp/WEB-INF/spring/spring-security.xml",
"file:src/test/resources/test-config.xml" "file:src/test/resources/test-config.xml"
}) })
@ActiveProfiles("test") @ActiveProfiles("test")
......
...@@ -22,7 +22,6 @@ import de.thm.arsnova.entities.Statistics; ...@@ -22,7 +22,6 @@ import de.thm.arsnova.entities.Statistics;
@ContextConfiguration(locations = { @ContextConfiguration(locations = {
"file:src/main/webapp/WEB-INF/spring/arsnova-servlet.xml", "file:src/main/webapp/WEB-INF/spring/arsnova-servlet.xml",
"file:src/main/webapp/WEB-INF/spring/spring-main.xml", "file:src/main/webapp/WEB-INF/spring/spring-main.xml",
"file:src/main/webapp/WEB-INF/spring/spring-security.xml",
"file:src/test/resources/test-config.xml" "file:src/test/resources/test-config.xml"
}) })
@ActiveProfiles("test") @ActiveProfiles("test")
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" <beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:websocket="http://www.springframework.org/schema/websocket" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
xmlns:security="http://www.springframework.org/schema/security"
xsi:schemaLocation="http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd
http://www.springframework.org/schema/websocket http://www.springframework.org/schema/websocket/spring-websocket-4.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd">
<bean id="servletContext" class="org.springframework.mock.web.MockServletContext"> <bean id="servletContext" class="org.springframework.mock.web.MockServletContext">
<property name="contextPath" value="/" /> <property name="contextPath" value="/" />
...@@ -31,6 +26,7 @@ ...@@ -31,6 +26,7 @@
</property> </property>
</bean> </bean>
<!--
<security:authentication-manager> <security:authentication-manager>
<security:authentication-provider> <security:authentication-provider>
<security:user-service> <security:user-service>
...@@ -39,4 +35,5 @@ ...@@ -39,4 +35,5 @@
</security:user-service> </security:user-service>
</security:authentication-provider> </security:authentication-provider>
</security:authentication-manager> </security:authentication-manager>
-->
</beans> </beans>
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" <beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:p="http://www.springframework.org/schema/p" xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">
<bean id="socketServer" class="de.thm.arsnova.socket.ARSnovaSocketIOServer" <bean id="socketServer" class="de.thm.arsnova.socket.ARSnovaSocketIOServer"
init-method="startServer" destroy-method="stopServer" scope="singleton" init-method="startServer" destroy-method="stopServer" scope="singleton"
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment