diff --git a/src/main/java/de/thm/arsnova/CASLogoutSuccessHandler.java b/src/main/java/de/thm/arsnova/CASLogoutSuccessHandler.java index 5d73848f3222c3a269aa1a2144420fe91e3f0f74..f88882261a44b6c7ab6cee1bfa151a8280fe972c 100644 --- a/src/main/java/de/thm/arsnova/CASLogoutSuccessHandler.java +++ b/src/main/java/de/thm/arsnova/CASLogoutSuccessHandler.java @@ -17,12 +17,6 @@ */ package de.thm.arsnova; -import java.io.IOException; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.security.core.Authentication; @@ -30,6 +24,11 @@ import org.springframework.security.web.DefaultRedirectStrategy; import org.springframework.security.web.RedirectStrategy; import org.springframework.security.web.authentication.logout.LogoutSuccessHandler; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + /** * This class gets called when a user has been successfully logged out from CAS. */ diff --git a/src/main/java/de/thm/arsnova/CasUserDetailsService.java b/src/main/java/de/thm/arsnova/CasUserDetailsService.java index 5998d96e82f257570c991e960675c6208c451625..84209e3172c15a14a3263c3772dd6117a79d5082 100644 --- a/src/main/java/de/thm/arsnova/CasUserDetailsService.java +++ b/src/main/java/de/thm/arsnova/CasUserDetailsService.java @@ -17,9 +17,6 @@ */ package de.thm.arsnova; -import java.util.ArrayList; -import java.util.List; - import org.jasig.cas.client.validation.Assertion; import org.springframework.security.cas.userdetails.AbstractCasAssertionUserDetailsService; import org.springframework.security.core.GrantedAuthority; @@ -28,6 +25,9 @@ import org.springframework.security.core.userdetails.User; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.stereotype.Service; +import java.util.ArrayList; +import java.util.List; + /** * Class to load a user based on the results from CAS. */ diff --git a/src/main/java/de/thm/arsnova/FeedbackStorage.java b/src/main/java/de/thm/arsnova/FeedbackStorage.java index afa717dd476c3fc58808c218e15ba01f9414d9eb..6b4950e7ca38dac702a75dc3eb5a1e8f95e32308 100644 --- a/src/main/java/de/thm/arsnova/FeedbackStorage.java +++ b/src/main/java/de/thm/arsnova/FeedbackStorage.java @@ -17,6 +17,12 @@ */ package de.thm.arsnova; +import de.thm.arsnova.entities.Feedback; +import de.thm.arsnova.entities.Session; +import de.thm.arsnova.entities.User; +import org.springframework.transaction.annotation.Isolation; +import org.springframework.transaction.annotation.Transactional; + import java.util.ArrayList; import java.util.Date; import java.util.HashMap; @@ -25,13 +31,6 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.TimeUnit; -import org.springframework.transaction.annotation.Isolation; -import org.springframework.transaction.annotation.Transactional; - -import de.thm.arsnova.entities.Feedback; -import de.thm.arsnova.entities.Session; -import de.thm.arsnova.entities.User; - /** * In-memory storage of feedback data. */ diff --git a/src/main/java/de/thm/arsnova/ImageUtils.java b/src/main/java/de/thm/arsnova/ImageUtils.java index 093ecc831a35feb0fdf45a1e40a53a186459665b..3877bd1cdb16883a3839f5cd975496e8bf9c5856 100644 --- a/src/main/java/de/thm/arsnova/ImageUtils.java +++ b/src/main/java/de/thm/arsnova/ImageUtils.java @@ -17,7 +17,15 @@ */ package de.thm.arsnova; -import java.awt.Graphics2D; +import de.thm.arsnova.entities.Answer; +import org.apache.commons.codec.binary.Base64; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +import javax.imageio.ImageIO; +import java.awt.*; import java.awt.image.BufferedImage; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -26,17 +34,6 @@ import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; -import javax.imageio.ImageIO; - -import org.apache.commons.codec.binary.Base64; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; -import org.springframework.context.annotation.Configuration; - -import de.thm.arsnova.entities.Answer; - /** * Util class for image operations. * diff --git a/src/main/java/de/thm/arsnova/LoginAuthenticationFailureHandler.java b/src/main/java/de/thm/arsnova/LoginAuthenticationFailureHandler.java index 706fb388b72d5918c37672207ac9aa4ae505adbd..c66cb80bd03b9500af84c261af6be48cc4d9e12a 100644 --- a/src/main/java/de/thm/arsnova/LoginAuthenticationFailureHandler.java +++ b/src/main/java/de/thm/arsnova/LoginAuthenticationFailureHandler.java @@ -17,13 +17,6 @@ */ package de.thm.arsnova; -import java.io.IOException; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.security.core.AuthenticationException; @@ -31,6 +24,12 @@ import org.springframework.security.web.DefaultRedirectStrategy; import org.springframework.security.web.RedirectStrategy; import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import java.io.IOException; + /** * This class gets called when a user failed to login. diff --git a/src/main/java/de/thm/arsnova/LoginAuthenticationSucessHandler.java b/src/main/java/de/thm/arsnova/LoginAuthenticationSucessHandler.java index 68ccd362dd0f707538f0332bbc2053cb4508db80..ddd029dd9491bb16a116d4951d6a590cc212d6a4 100644 --- a/src/main/java/de/thm/arsnova/LoginAuthenticationSucessHandler.java +++ b/src/main/java/de/thm/arsnova/LoginAuthenticationSucessHandler.java @@ -17,14 +17,14 @@ */ package de.thm.arsnova; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.security.web.authentication.SimpleUrlAuthenticationSuccessHandler; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + /** * This class gets called when a user successfully logged in. */ diff --git a/src/main/java/de/thm/arsnova/aop/RangeAspect.java b/src/main/java/de/thm/arsnova/aop/RangeAspect.java index 828eb4af459a86b5ec65966aebe4bf4b6a6637b2..02899e0a5eab40f662e44fe2952f1d23777a744b 100644 --- a/src/main/java/de/thm/arsnova/aop/RangeAspect.java +++ b/src/main/java/de/thm/arsnova/aop/RangeAspect.java @@ -17,13 +17,9 @@ */ package de.thm.arsnova.aop; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - +import de.thm.arsnova.PaginationListDecorator; +import de.thm.arsnova.controller.PaginationController; +import de.thm.arsnova.services.ResponseProviderService; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; @@ -33,9 +29,11 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Component; -import de.thm.arsnova.PaginationListDecorator; -import de.thm.arsnova.controller.PaginationController; -import de.thm.arsnova.services.ResponseProviderService; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; /** * An aspect which parses requests for pagination parameters in a "Range" header and adds a "Content-Range" header to diff --git a/src/main/java/de/thm/arsnova/aop/UserSessionAspect.java b/src/main/java/de/thm/arsnova/aop/UserSessionAspect.java index ee9b6a90c88eeadd7322d7e7b41d4f46b41f6a4a..da9a92299c8de46ea906c7eddbef2d004645dbb4 100644 --- a/src/main/java/de/thm/arsnova/aop/UserSessionAspect.java +++ b/src/main/java/de/thm/arsnova/aop/UserSessionAspect.java @@ -17,14 +17,13 @@ */ package de.thm.arsnova.aop; +import de.thm.arsnova.entities.Session; +import de.thm.arsnova.services.UserSessionService; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.annotation.AfterReturning; import org.aspectj.lang.annotation.Aspect; import org.springframework.beans.factory.annotation.Autowired; -import de.thm.arsnova.entities.Session; -import de.thm.arsnova.services.UserSessionService; - /** * Assigns a session to the {@link de.thm.arsnova.services.UserSessionService} whenever a user joins a * session. diff --git a/src/main/java/de/thm/arsnova/cache/CacheBustListener.java b/src/main/java/de/thm/arsnova/cache/CacheBustListener.java index 68520b619b1bbf5e343b71ba092d3a3310ad8f4f..99b7809f18fc43960e56936748b6ba9b0a5b408f 100644 --- a/src/main/java/de/thm/arsnova/cache/CacheBustListener.java +++ b/src/main/java/de/thm/arsnova/cache/CacheBustListener.java @@ -17,13 +17,12 @@ */ package de.thm.arsnova.cache; +import de.thm.arsnova.events.NovaEvent; +import de.thm.arsnova.events.NovaEventVisitor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationListener; import org.springframework.stereotype.Component; -import de.thm.arsnova.events.NovaEvent; -import de.thm.arsnova.events.NovaEventVisitor; - /** * Listener registration for the cache buster. * diff --git a/src/main/java/de/thm/arsnova/cache/CacheBuster.java b/src/main/java/de/thm/arsnova/cache/CacheBuster.java index 3298bc4dcd4477ba5f1791c772e4c36d1d1a86a3..5d1b1ccc2d82c57d5b1c2150c7804e195072a2e5 100644 --- a/src/main/java/de/thm/arsnova/cache/CacheBuster.java +++ b/src/main/java/de/thm/arsnova/cache/CacheBuster.java @@ -17,41 +17,10 @@ */ package de.thm.arsnova.cache; +import de.thm.arsnova.events.*; import org.springframework.cache.annotation.CacheEvict; import org.springframework.stereotype.Component; -import de.thm.arsnova.events.ChangeLearningProgressEvent; -import de.thm.arsnova.events.DeleteAllLectureAnswersEvent; -import de.thm.arsnova.events.DeleteAllPreparationAnswersEvent; -import de.thm.arsnova.events.DeleteAllQuestionsAnswersEvent; -import de.thm.arsnova.events.DeleteAllQuestionsEvent; -import de.thm.arsnova.events.DeleteAnswerEvent; -import de.thm.arsnova.events.DeleteFeedbackForSessionsEvent; -import de.thm.arsnova.events.DeleteInterposedQuestionEvent; -import de.thm.arsnova.events.DeleteQuestionEvent; -import de.thm.arsnova.events.DeleteSessionEvent; -import de.thm.arsnova.events.FeatureChangeEvent; -import de.thm.arsnova.events.LockFeedbackEvent; -import de.thm.arsnova.events.LockQuestionEvent; -import de.thm.arsnova.events.LockQuestionsEvent; -import de.thm.arsnova.events.LockVoteEvent; -import de.thm.arsnova.events.LockVotesEvent; -import de.thm.arsnova.events.NewAnswerEvent; -import de.thm.arsnova.events.NewFeedbackEvent; -import de.thm.arsnova.events.NewInterposedQuestionEvent; -import de.thm.arsnova.events.NewQuestionEvent; -import de.thm.arsnova.events.UnlockQuestionEvent; -import de.thm.arsnova.events.UnlockQuestionsEvent; -import de.thm.arsnova.events.NewSessionEvent; -import de.thm.arsnova.events.NovaEventVisitor; -import de.thm.arsnova.events.PiRoundCancelEvent; -import de.thm.arsnova.events.PiRoundDelayedStartEvent; -import de.thm.arsnova.events.PiRoundEndEvent; -import de.thm.arsnova.events.PiRoundResetEvent; -import de.thm.arsnova.events.StatusSessionEvent; -import de.thm.arsnova.events.UnlockVoteEvent; -import de.thm.arsnova.events.UnlockVotesEvent; - /** * This class is used to evict caches based on events. The events carry all necessary information to clear the * caches, e.g, for a specific session. diff --git a/src/main/java/de/thm/arsnova/config/ExtraConfig.java b/src/main/java/de/thm/arsnova/config/ExtraConfig.java index 3adfec49d75dd38a856c0dd09a5ec10c3ac19537..2ff86cafdedfb47f5e5f113ea9d9772949452cd0 100644 --- a/src/main/java/de/thm/arsnova/config/ExtraConfig.java +++ b/src/main/java/de/thm/arsnova/config/ExtraConfig.java @@ -17,6 +17,11 @@ */ package de.thm.arsnova.config; +import de.thm.arsnova.ImageUtils; +import de.thm.arsnova.connector.client.ConnectorClient; +import de.thm.arsnova.connector.client.ConnectorClientImpl; +import de.thm.arsnova.socket.ARSnovaSocket; +import de.thm.arsnova.socket.ARSnovaSocketIOServer; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.config.PropertiesFactoryBean; @@ -31,16 +36,8 @@ import org.springframework.core.env.Environment; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.FileSystemResource; import org.springframework.core.io.Resource; -import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; -import org.springframework.context.annotation.Import; import org.springframework.web.servlet.config.annotation.EnableWebMvc; - -import de.thm.arsnova.connector.client.ConnectorClient; -import de.thm.arsnova.connector.client.ConnectorClientImpl; -import de.thm.arsnova.socket.ARSnovaSocket; -import de.thm.arsnova.socket.ARSnovaSocketIOServer; -import de.thm.arsnova.ImageUtils; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; /** diff --git a/src/main/java/de/thm/arsnova/config/SecurityConfig.java b/src/main/java/de/thm/arsnova/config/SecurityConfig.java index 7f8d417242ad8e861b93950ad2721e88ce1393da..cccb20b235e4deb97a9da055ddc78caaa50b8918 100644 --- a/src/main/java/de/thm/arsnova/config/SecurityConfig.java +++ b/src/main/java/de/thm/arsnova/config/SecurityConfig.java @@ -17,11 +17,15 @@ */ package de.thm.arsnova.config; -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.ServletContext; - +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.OAuthAuthenticationFilter; +import de.thm.arsnova.CASLogoutSuccessHandler; +import de.thm.arsnova.CasUserDetailsService; +import de.thm.arsnova.LoginAuthenticationFailureHandler; +import de.thm.arsnova.LoginAuthenticationSucessHandler; +import de.thm.arsnova.security.ApplicationPermissionEvaluator; +import de.thm.arsnova.security.DbUserDetailsService; import org.jasig.cas.client.validation.Cas20ProxyTicketValidator; import org.scribe.up.provider.impl.FacebookProvider; import org.scribe.up.provider.impl.Google2Provider; @@ -70,16 +74,9 @@ import org.springframework.security.web.header.writers.HstsHeaderWriter; 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.web.OAuthAuthenticationEntryPoint; -import com.github.leleuj.ss.oauth.client.web.OAuthAuthenticationFilter; - -import de.thm.arsnova.CASLogoutSuccessHandler; -import de.thm.arsnova.CasUserDetailsService; -import de.thm.arsnova.LoginAuthenticationFailureHandler; -import de.thm.arsnova.LoginAuthenticationSucessHandler; -import de.thm.arsnova.security.ApplicationPermissionEvaluator; -import de.thm.arsnova.security.DbUserDetailsService; +import javax.servlet.ServletContext; +import java.util.ArrayList; +import java.util.List; /** * Loads property file and configures components used for authentication. diff --git a/src/main/java/de/thm/arsnova/controller/AudienceQuestionController.java b/src/main/java/de/thm/arsnova/controller/AudienceQuestionController.java index 2f60da21dd009c4e363e9321aab34b89a72d8b24..49472664ee824fe1c57065592efb09725d584118 100644 --- a/src/main/java/de/thm/arsnova/controller/AudienceQuestionController.java +++ b/src/main/java/de/thm/arsnova/controller/AudienceQuestionController.java @@ -17,8 +17,17 @@ */ package de.thm.arsnova.controller; -import java.util.List; - +import de.thm.arsnova.entities.InterposedReadingCount; +import de.thm.arsnova.entities.transport.InterposedQuestion; +import de.thm.arsnova.exceptions.BadRequestException; +import de.thm.arsnova.services.IQuestionService; +import de.thm.arsnova.web.DeprecatedApi; +import de.thm.arsnova.web.Pagination; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -31,18 +40,7 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; - -import de.thm.arsnova.entities.InterposedReadingCount; -import de.thm.arsnova.entities.transport.InterposedQuestion; -import de.thm.arsnova.exceptions.BadRequestException; -import de.thm.arsnova.services.IQuestionService; -import de.thm.arsnova.web.DeprecatedApi; -import de.thm.arsnova.web.Pagination; +import java.util.List; /** * Handles requests related to audience questions, which are also called interposed or feedback questions. diff --git a/src/main/java/de/thm/arsnova/controller/ConfigurationController.java b/src/main/java/de/thm/arsnova/controller/ConfigurationController.java index 610dc2e3b0a42c8f8ca68bf3f01567eb990cb391..02b91685bb2cac004aeae9d9b71e3b1c3635689b 100644 --- a/src/main/java/de/thm/arsnova/controller/ConfigurationController.java +++ b/src/main/java/de/thm/arsnova/controller/ConfigurationController.java @@ -17,10 +17,6 @@ */ package de.thm.arsnova.controller; -import java.util.HashMap; - -import javax.servlet.http.HttpServletRequest; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; @@ -29,6 +25,9 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; +import javax.servlet.http.HttpServletRequest; +import java.util.HashMap; + /** * The ConfigurationController provides frontend clients with information necessary to correctly interact with the * backend and other frontends as well as settings for ARSnova. The the alternative /arsnova-config route is necessary diff --git a/src/main/java/de/thm/arsnova/controller/CourseController.java b/src/main/java/de/thm/arsnova/controller/CourseController.java index e79f77496c73b4dc22bd05da0edd6f798eac0b10..f27d177974c9a2fd983a290c314e9a8c2a5e0221 100644 --- a/src/main/java/de/thm/arsnova/controller/CourseController.java +++ b/src/main/java/de/thm/arsnova/controller/CourseController.java @@ -17,12 +17,14 @@ */ package de.thm.arsnova.controller; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; - +import de.thm.arsnova.connector.client.ConnectorClient; +import de.thm.arsnova.connector.model.Course; +import de.thm.arsnova.connector.model.UserRole; +import de.thm.arsnova.entities.User; +import de.thm.arsnova.exceptions.NotImplementedException; +import de.thm.arsnova.exceptions.UnauthorizedException; +import de.thm.arsnova.services.IUserService; +import io.swagger.annotations.ApiParam; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -30,19 +32,12 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import de.thm.arsnova.connector.client.ConnectorClient; -import de.thm.arsnova.connector.model.Course; -import de.thm.arsnova.connector.model.UserRole; -import de.thm.arsnova.entities.User; -import de.thm.arsnova.exceptions.NotImplementedException; -import de.thm.arsnova.exceptions.UnauthorizedException; -import de.thm.arsnova.services.IUserService; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; /** * Provides access to a user's courses in an LMS such as Moodle. diff --git a/src/main/java/de/thm/arsnova/controller/FeedbackController.java b/src/main/java/de/thm/arsnova/controller/FeedbackController.java index 98827df3cec5ba9b08236b41d1f5a8e3f91ecc14..b62e22c31a035c53571aa8afca63cee843f404c4 100644 --- a/src/main/java/de/thm/arsnova/controller/FeedbackController.java +++ b/src/main/java/de/thm/arsnova/controller/FeedbackController.java @@ -17,6 +17,12 @@ */ package de.thm.arsnova.controller; +import de.thm.arsnova.entities.Feedback; +import de.thm.arsnova.entities.User; +import de.thm.arsnova.exceptions.NotFoundException; +import de.thm.arsnova.services.IFeedbackService; +import de.thm.arsnova.services.IUserService; +import de.thm.arsnova.web.DeprecatedApi; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -28,18 +34,6 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; - -import de.thm.arsnova.entities.Feedback; -import de.thm.arsnova.entities.User; -import de.thm.arsnova.exceptions.NotFoundException; -import de.thm.arsnova.services.IFeedbackService; -import de.thm.arsnova.services.IUserService; -import de.thm.arsnova.web.DeprecatedApi; - /** * Handles requests concerning the user's feedback, i.e., "too fast" or "faster, please". This HTTP API is * deprecated in favor of the socket implementation. diff --git a/src/main/java/de/thm/arsnova/controller/LecturerQuestionController.java b/src/main/java/de/thm/arsnova/controller/LecturerQuestionController.java index fe8fcedc0b220198e75a9b62ce77bbaf61f460d7..945565766ca82a7482e763eb686834108d31bdad 100644 --- a/src/main/java/de/thm/arsnova/controller/LecturerQuestionController.java +++ b/src/main/java/de/thm/arsnova/controller/LecturerQuestionController.java @@ -17,12 +17,20 @@ */ package de.thm.arsnova.controller; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import javax.servlet.http.HttpServletResponse; - +import de.thm.arsnova.PaginationListDecorator; +import de.thm.arsnova.entities.Answer; +import de.thm.arsnova.entities.Question; +import de.thm.arsnova.exceptions.BadRequestException; +import de.thm.arsnova.exceptions.ForbiddenException; +import de.thm.arsnova.exceptions.NoContentException; +import de.thm.arsnova.exceptions.NotFoundException; +import de.thm.arsnova.services.IQuestionService; +import de.thm.arsnova.web.DeprecatedApi; +import de.thm.arsnova.web.Pagination; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -35,21 +43,10 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; - -import de.thm.arsnova.PaginationListDecorator; -import de.thm.arsnova.entities.Answer; -import de.thm.arsnova.entities.Question; -import de.thm.arsnova.exceptions.BadRequestException; -import de.thm.arsnova.exceptions.ForbiddenException; -import de.thm.arsnova.exceptions.NoContentException; -import de.thm.arsnova.exceptions.NotFoundException; -import de.thm.arsnova.services.IQuestionService; -import de.thm.arsnova.web.DeprecatedApi; -import de.thm.arsnova.web.Pagination; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; /** * Handles requests related to questions teachers are asking their students. @@ -652,7 +649,7 @@ public class LecturerQuestionController extends PaginationController { throw new BadRequestException(); } } - + @RequestMapping(value = "/questionsort", method = RequestMethod.GET) public String getQuestionSortType( @RequestParam(required = true) final String sessionkey, diff --git a/src/main/java/de/thm/arsnova/controller/LegacyController.java b/src/main/java/de/thm/arsnova/controller/LegacyController.java index c15295d0671d31dbb7c5aed0396721ea56716965..7c8d15aa94cf14491f4dd6094de7b7f119f4e162 100644 --- a/src/main/java/de/thm/arsnova/controller/LegacyController.java +++ b/src/main/java/de/thm/arsnova/controller/LegacyController.java @@ -17,6 +17,8 @@ */ package de.thm.arsnova.controller; +import de.thm.arsnova.services.IQuestionService; +import de.thm.arsnova.web.DeprecatedApi; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -26,9 +28,6 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; -import de.thm.arsnova.services.IQuestionService; -import de.thm.arsnova.web.DeprecatedApi; - /** * This controller forwards requests from deprecated URLs to their new controller, where the requests are handled. */ diff --git a/src/main/java/de/thm/arsnova/controller/LoginController.java b/src/main/java/de/thm/arsnova/controller/LoginController.java index 3b6d96803ec6ae2f34f9f0575d97a4aa87ce5fcf..f90a78f3b648819b41a3563379083db0d965ecc8 100644 --- a/src/main/java/de/thm/arsnova/controller/LoginController.java +++ b/src/main/java/de/thm/arsnova/controller/LoginController.java @@ -17,16 +17,12 @@ */ package de.thm.arsnova.controller; -import java.io.IOException; -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - +import de.thm.arsnova.entities.ServiceDescription; +import de.thm.arsnova.entities.Session; +import de.thm.arsnova.entities.User; +import de.thm.arsnova.exceptions.UnauthorizedException; +import de.thm.arsnova.services.IUserService; +import de.thm.arsnova.services.UserSessionService; import org.scribe.up.provider.impl.FacebookProvider; import org.scribe.up.provider.impl.Google2Provider; import org.scribe.up.provider.impl.TwitterProvider; @@ -57,12 +53,14 @@ import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.View; import org.springframework.web.servlet.view.RedirectView; -import de.thm.arsnova.entities.ServiceDescription; -import de.thm.arsnova.entities.Session; -import de.thm.arsnova.entities.User; -import de.thm.arsnova.exceptions.UnauthorizedException; -import de.thm.arsnova.services.IUserService; -import de.thm.arsnova.services.UserSessionService; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; /** * Handles authentication specific requests. diff --git a/src/main/java/de/thm/arsnova/controller/MotdController.java b/src/main/java/de/thm/arsnova/controller/MotdController.java index 5f56ec19aceb3c72d3d091ee0935d4911279a6b3..16f81b0273e8ac1a1454c5da762cb9a464493e48 100644 --- a/src/main/java/de/thm/arsnova/controller/MotdController.java +++ b/src/main/java/de/thm/arsnova/controller/MotdController.java @@ -17,21 +17,18 @@ */ package de.thm.arsnova.controller; -import java.util.Date; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.Set; -import java.util.HashSet; -import java.util.Arrays; - -import javax.servlet.http.HttpServletResponse; - +import de.thm.arsnova.entities.Motd; +import de.thm.arsnova.entities.MotdList; +import de.thm.arsnova.services.IMotdService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; -import org.springframework.security.access.AccessDeniedException; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; @@ -40,16 +37,10 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; - -import de.thm.arsnova.entities.Motd; -import de.thm.arsnova.entities.MotdList; -import de.thm.arsnova.exceptions.NotFoundException; -import de.thm.arsnova.services.IMotdService; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; /** * diff --git a/src/main/java/de/thm/arsnova/controller/SecurityExceptionControllerAdvice.java b/src/main/java/de/thm/arsnova/controller/SecurityExceptionControllerAdvice.java index f516b2c0728f954c69938a1c4636d5f78798eaba..8b7f0907cd6a3bd930b4f4eeae0ca88c9e7fa936 100644 --- a/src/main/java/de/thm/arsnova/controller/SecurityExceptionControllerAdvice.java +++ b/src/main/java/de/thm/arsnova/controller/SecurityExceptionControllerAdvice.java @@ -17,12 +17,14 @@ */ package de.thm.arsnova.controller; -import java.util.HashMap; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - +import de.thm.arsnova.exceptions.BadRequestException; +import de.thm.arsnova.exceptions.ForbiddenException; +import de.thm.arsnova.exceptions.NoContentException; +import de.thm.arsnova.exceptions.NotFoundException; +import de.thm.arsnova.exceptions.NotImplementedException; +import de.thm.arsnova.exceptions.PayloadTooLargeException; +import de.thm.arsnova.exceptions.PreconditionFailedException; +import de.thm.arsnova.exceptions.UnauthorizedException; import org.springframework.http.HttpStatus; import org.springframework.security.access.AccessDeniedException; import org.springframework.security.authentication.AnonymousAuthenticationToken; @@ -33,14 +35,10 @@ import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ResponseStatus; -import de.thm.arsnova.exceptions.BadRequestException; -import de.thm.arsnova.exceptions.ForbiddenException; -import de.thm.arsnova.exceptions.NoContentException; -import de.thm.arsnova.exceptions.NotFoundException; -import de.thm.arsnova.exceptions.NotImplementedException; -import de.thm.arsnova.exceptions.PayloadTooLargeException; -import de.thm.arsnova.exceptions.PreconditionFailedException; -import de.thm.arsnova.exceptions.UnauthorizedException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.HashMap; +import java.util.Map; /** * Translates security/authentication related exceptions into HTTP status codes. diff --git a/src/main/java/de/thm/arsnova/controller/SessionController.java b/src/main/java/de/thm/arsnova/controller/SessionController.java index d1e4f32c306487054a7eca4f84e60861c5bd364d..9d94ffc5aef21772162aec4df3b89455767c20d2 100644 --- a/src/main/java/de/thm/arsnova/controller/SessionController.java +++ b/src/main/java/de/thm/arsnova/controller/SessionController.java @@ -17,31 +17,6 @@ */ package de.thm.arsnova.controller; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import javax.servlet.http.HttpServletResponse; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.security.access.AccessDeniedException; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseStatus; -import org.springframework.web.bind.annotation.RestController; - -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; - import de.thm.arsnova.connector.model.Course; import de.thm.arsnova.entities.Session; import de.thm.arsnova.entities.SessionFeature; @@ -57,6 +32,28 @@ import de.thm.arsnova.services.SessionService.SessionNameComparator; import de.thm.arsnova.services.SessionService.SessionShortNameComparator; import de.thm.arsnova.web.DeprecatedApi; import de.thm.arsnova.web.Pagination; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.security.access.AccessDeniedException; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseStatus; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; /** * Handles requests related to ARSnova sessions. diff --git a/src/main/java/de/thm/arsnova/controller/SocketController.java b/src/main/java/de/thm/arsnova/controller/SocketController.java index e6de3faf268b93db54a2e391234fc47cd1732ec9..9dce5f7cf5c6df0792915a8b38f0cf9163c19a52 100644 --- a/src/main/java/de/thm/arsnova/controller/SocketController.java +++ b/src/main/java/de/thm/arsnova/controller/SocketController.java @@ -17,12 +17,15 @@ */ package de.thm.arsnova.controller; -import java.util.Map; -import java.util.UUID; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - +import de.thm.arsnova.entities.User; +import de.thm.arsnova.services.IUserService; +import de.thm.arsnova.services.UserSessionService; +import de.thm.arsnova.socket.ARSnovaSocket; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -32,16 +35,10 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; - -import de.thm.arsnova.entities.User; -import de.thm.arsnova.services.IUserService; -import de.thm.arsnova.services.UserSessionService; -import de.thm.arsnova.socket.ARSnovaSocket; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Map; +import java.util.UUID; /** * Initiates the socket communication. diff --git a/src/main/java/de/thm/arsnova/controller/StatisticsController.java b/src/main/java/de/thm/arsnova/controller/StatisticsController.java index b1216c1056ba60f8fd0df2309fc5f24bec64358f..f747462cf0c16cb82857bb673ccc63adf4f7edd1 100644 --- a/src/main/java/de/thm/arsnova/controller/StatisticsController.java +++ b/src/main/java/de/thm/arsnova/controller/StatisticsController.java @@ -17,18 +17,16 @@ */ package de.thm.arsnova.controller; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; - -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; - import de.thm.arsnova.entities.Statistics; import de.thm.arsnova.services.IStatisticsService; import de.thm.arsnova.web.CacheControl; import de.thm.arsnova.web.DeprecatedApi; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; /** * Allows retrieval of several statistics such as the number of active users. diff --git a/src/main/java/de/thm/arsnova/controller/UserController.java b/src/main/java/de/thm/arsnova/controller/UserController.java index a113f184a4569d881391c552f900580f4775234f..269d70c43be91d9b069c1966c7f399b744fc7d07 100644 --- a/src/main/java/de/thm/arsnova/controller/UserController.java +++ b/src/main/java/de/thm/arsnova/controller/UserController.java @@ -17,9 +17,9 @@ */ package de.thm.arsnova.controller; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - +import de.thm.arsnova.entities.DbUser; +import de.thm.arsnova.services.IUserService; +import de.thm.arsnova.services.UserSessionService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -31,9 +31,8 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; -import de.thm.arsnova.entities.DbUser; -import de.thm.arsnova.services.IUserService; -import de.thm.arsnova.services.UserSessionService; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; /** * Handles requests related to ARSnova's own user registration and login process. diff --git a/src/main/java/de/thm/arsnova/controller/WelcomeController.java b/src/main/java/de/thm/arsnova/controller/WelcomeController.java index cf9d3d20432e99b100e39bf9c3b2c6584b0621fc..cabe824f6bf9baa1cc3bf8c66531e5564af9c77a 100644 --- a/src/main/java/de/thm/arsnova/controller/WelcomeController.java +++ b/src/main/java/de/thm/arsnova/controller/WelcomeController.java @@ -17,17 +17,8 @@ */ package de.thm.arsnova.controller; -import java.net.InetAddress; -import java.net.MalformedURLException; -import java.net.URL; -import java.net.UnknownHostException; -import java.util.HashMap; -import java.util.Map; -import java.util.Properties; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; - +import de.thm.arsnova.exceptions.BadRequestException; +import de.thm.arsnova.exceptions.NoContentException; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; @@ -43,8 +34,15 @@ import org.springframework.web.client.RestTemplate; import org.springframework.web.servlet.View; import org.springframework.web.servlet.view.RedirectView; -import de.thm.arsnova.exceptions.BadRequestException; -import de.thm.arsnova.exceptions.NoContentException; +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.net.InetAddress; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.UnknownHostException; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; /** * Default controller that handles requests which have not set a path. diff --git a/src/main/java/de/thm/arsnova/dao/CouchDBDao.java b/src/main/java/de/thm/arsnova/dao/CouchDBDao.java index 49a4a07701fae233b1a2a777bd5b01d70f2ed7ff..c4432847a59d7bf7075dd1659ad46161b75ef2a2 100644 --- a/src/main/java/de/thm/arsnova/dao/CouchDBDao.java +++ b/src/main/java/de/thm/arsnova/dao/CouchDBDao.java @@ -17,51 +17,12 @@ */ package de.thm.arsnova.dao; -import java.io.IOException; -import java.util.AbstractMap; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Queue; -import java.util.Set; -import java.util.concurrent.ConcurrentLinkedQueue; -import java.util.Date; -import java.util.StringTokenizer; - -import net.sf.ezmorph.Morpher; -import net.sf.ezmorph.MorpherRegistry; -import net.sf.ezmorph.bean.BeanMorpher; -import net.sf.json.JSONArray; -import net.sf.json.JSONObject; -import net.sf.json.util.JSONUtils; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.aop.framework.AopContext; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.cache.annotation.CacheEvict; -import org.springframework.cache.annotation.CachePut; -import org.springframework.cache.annotation.Cacheable; -import org.springframework.cache.annotation.Caching; -import org.springframework.context.ApplicationEventPublisher; -import org.springframework.context.ApplicationEventPublisherAware; -import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Isolation; -import org.springframework.transaction.annotation.Transactional; - import com.fourspaces.couchdb.Database; import com.fourspaces.couchdb.Document; import com.fourspaces.couchdb.Results; import com.fourspaces.couchdb.RowResult; import com.fourspaces.couchdb.View; import com.fourspaces.couchdb.ViewResults; - import de.thm.arsnova.connector.model.Course; import de.thm.arsnova.domain.CourseScore; import de.thm.arsnova.entities.Answer; @@ -69,6 +30,8 @@ import de.thm.arsnova.entities.DbUser; import de.thm.arsnova.entities.InterposedQuestion; import de.thm.arsnova.entities.InterposedReadingCount; import de.thm.arsnova.entities.LoggedIn; +import de.thm.arsnova.entities.Motd; +import de.thm.arsnova.entities.MotdList; import de.thm.arsnova.entities.PossibleAnswer; import de.thm.arsnova.entities.Question; import de.thm.arsnova.entities.Session; @@ -83,8 +46,41 @@ import de.thm.arsnova.entities.transport.ImportExportSession.ImportExportQuestio import de.thm.arsnova.events.NewAnswerEvent; import de.thm.arsnova.exceptions.NotFoundException; import de.thm.arsnova.services.ISessionService; -import de.thm.arsnova.entities.Motd; -import de.thm.arsnova.entities.MotdList; +import net.sf.ezmorph.Morpher; +import net.sf.ezmorph.MorpherRegistry; +import net.sf.ezmorph.bean.BeanMorpher; +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; +import net.sf.json.util.JSONUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.aop.framework.AopContext; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.CachePut; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.cache.annotation.Caching; +import org.springframework.context.ApplicationEventPublisher; +import org.springframework.context.ApplicationEventPublisherAware; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Isolation; +import org.springframework.transaction.annotation.Transactional; + +import java.io.IOException; +import java.util.AbstractMap; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Queue; +import java.util.Set; +import java.util.concurrent.ConcurrentLinkedQueue; /** * Database implementation based on CouchDB. diff --git a/src/main/java/de/thm/arsnova/dao/IDatabaseDao.java b/src/main/java/de/thm/arsnova/dao/IDatabaseDao.java index 0990dfe8c0d94a7167f5f094f3d025401efc5b06..e6885b30a6091b96b4c8b143bd7376b1d73a94bf 100644 --- a/src/main/java/de/thm/arsnova/dao/IDatabaseDao.java +++ b/src/main/java/de/thm/arsnova/dao/IDatabaseDao.java @@ -17,8 +17,6 @@ */ package de.thm.arsnova.dao; -import java.util.List; - import de.thm.arsnova.connector.model.Course; import de.thm.arsnova.domain.CourseScore; import de.thm.arsnova.entities.Answer; @@ -26,6 +24,8 @@ import de.thm.arsnova.entities.DbUser; import de.thm.arsnova.entities.InterposedQuestion; import de.thm.arsnova.entities.InterposedReadingCount; import de.thm.arsnova.entities.LoggedIn; +import de.thm.arsnova.entities.Motd; +import de.thm.arsnova.entities.MotdList; import de.thm.arsnova.entities.Question; import de.thm.arsnova.entities.Session; import de.thm.arsnova.entities.SessionInfo; @@ -33,8 +33,8 @@ import de.thm.arsnova.entities.SortOrder; import de.thm.arsnova.entities.Statistics; import de.thm.arsnova.entities.User; import de.thm.arsnova.entities.transport.ImportExportSession; -import de.thm.arsnova.entities.Motd; -import de.thm.arsnova.entities.MotdList; + +import java.util.List; /** * All methods the database must support. diff --git a/src/main/java/de/thm/arsnova/domain/CourseScore.java b/src/main/java/de/thm/arsnova/domain/CourseScore.java index 8a689b75cfe359aa01aa39b7dd56ae611310a2c7..e79cd6ff540e6a4c743e4a1efb8a1df5cfc222ba 100644 --- a/src/main/java/de/thm/arsnova/domain/CourseScore.java +++ b/src/main/java/de/thm/arsnova/domain/CourseScore.java @@ -17,6 +17,8 @@ */ package de.thm.arsnova.domain; +import de.thm.arsnova.entities.User; + import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; @@ -24,8 +26,6 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; -import de.thm.arsnova.entities.User; - /** * Calculates the learning progress for users and their courses. */ diff --git a/src/main/java/de/thm/arsnova/domain/LearningProgressFactory.java b/src/main/java/de/thm/arsnova/domain/LearningProgressFactory.java index 60ed2f01ee59ae89564b603396d73f2ffedf7057..8e50d4a5e275b0731d0ac5e5fc838375c1e1569e 100644 --- a/src/main/java/de/thm/arsnova/domain/LearningProgressFactory.java +++ b/src/main/java/de/thm/arsnova/domain/LearningProgressFactory.java @@ -17,45 +17,14 @@ */ package de.thm.arsnova.domain; +import de.thm.arsnova.dao.IDatabaseDao; +import de.thm.arsnova.events.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cache.annotation.CacheEvict; import org.springframework.context.ApplicationEventPublisher; import org.springframework.context.ApplicationEventPublisherAware; import org.springframework.stereotype.Component; -import de.thm.arsnova.dao.IDatabaseDao; -import de.thm.arsnova.events.ChangeLearningProgressEvent; -import de.thm.arsnova.events.DeleteAllLectureAnswersEvent; -import de.thm.arsnova.events.DeleteAllPreparationAnswersEvent; -import de.thm.arsnova.events.DeleteAllQuestionsAnswersEvent; -import de.thm.arsnova.events.DeleteAllQuestionsEvent; -import de.thm.arsnova.events.DeleteAnswerEvent; -import de.thm.arsnova.events.DeleteFeedbackForSessionsEvent; -import de.thm.arsnova.events.DeleteInterposedQuestionEvent; -import de.thm.arsnova.events.DeleteQuestionEvent; -import de.thm.arsnova.events.DeleteSessionEvent; -import de.thm.arsnova.events.FeatureChangeEvent; -import de.thm.arsnova.events.LockFeedbackEvent; -import de.thm.arsnova.events.LockQuestionEvent; -import de.thm.arsnova.events.LockQuestionsEvent; -import de.thm.arsnova.events.LockVoteEvent; -import de.thm.arsnova.events.LockVotesEvent; -import de.thm.arsnova.events.NewAnswerEvent; -import de.thm.arsnova.events.NewFeedbackEvent; -import de.thm.arsnova.events.NewInterposedQuestionEvent; -import de.thm.arsnova.events.NewQuestionEvent; -import de.thm.arsnova.events.UnlockQuestionEvent; -import de.thm.arsnova.events.UnlockQuestionsEvent; -import de.thm.arsnova.events.NewSessionEvent; -import de.thm.arsnova.events.NovaEventVisitor; -import de.thm.arsnova.events.PiRoundCancelEvent; -import de.thm.arsnova.events.PiRoundDelayedStartEvent; -import de.thm.arsnova.events.PiRoundEndEvent; -import de.thm.arsnova.events.PiRoundResetEvent; -import de.thm.arsnova.events.StatusSessionEvent; -import de.thm.arsnova.events.UnlockVoteEvent; -import de.thm.arsnova.events.UnlockVotesEvent; - /** * Creates a learning progress implementation. * diff --git a/src/main/java/de/thm/arsnova/domain/LearningProgressListener.java b/src/main/java/de/thm/arsnova/domain/LearningProgressListener.java index 641e26ae614ab1475475b58ade2fc851644dcc31..958eea201122ddcbde41914722bc136ec52a93ef 100644 --- a/src/main/java/de/thm/arsnova/domain/LearningProgressListener.java +++ b/src/main/java/de/thm/arsnova/domain/LearningProgressListener.java @@ -17,13 +17,12 @@ */ package de.thm.arsnova.domain; +import de.thm.arsnova.events.NovaEvent; +import de.thm.arsnova.events.NovaEventVisitor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationListener; import org.springframework.stereotype.Component; -import de.thm.arsnova.events.NovaEvent; -import de.thm.arsnova.events.NovaEventVisitor; - /** * Listener registration for the learning progress. * diff --git a/src/main/java/de/thm/arsnova/domain/QuestionScore.java b/src/main/java/de/thm/arsnova/domain/QuestionScore.java index c2021f15ce4bd4d92aa35602561d6a24b98b302c..4c1ab0d8b07da83fb065e8882e1fee6281f50a8e 100644 --- a/src/main/java/de/thm/arsnova/domain/QuestionScore.java +++ b/src/main/java/de/thm/arsnova/domain/QuestionScore.java @@ -17,13 +17,13 @@ */ package de.thm.arsnova.domain; +import de.thm.arsnova.entities.User; + import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Set; -import de.thm.arsnova.entities.User; - /** * Calculates learning progress score for a specific question. */ diff --git a/src/main/java/de/thm/arsnova/entities/Motd.java b/src/main/java/de/thm/arsnova/entities/Motd.java index 571d7e4f28f199c43b61f5fb74075caef6a5f0f3..439f75db432de1ca669f515ab9be4e9c38400820 100644 --- a/src/main/java/de/thm/arsnova/entities/Motd.java +++ b/src/main/java/de/thm/arsnova/entities/Motd.java @@ -17,11 +17,11 @@ */ package de.thm.arsnova.entities; -import java.util.Date; - import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import java.util.Date; + /** * This class represents a message of the day. */ diff --git a/src/main/java/de/thm/arsnova/entities/Question.java b/src/main/java/de/thm/arsnova/entities/Question.java index e393eaf2371c5c73c22d496686551933fd9b552a..f73d0bf9b79a1320e88e4bab9d48838febcfdcc5 100644 --- a/src/main/java/de/thm/arsnova/entities/Question.java +++ b/src/main/java/de/thm/arsnova/entities/Question.java @@ -17,13 +17,13 @@ */ package de.thm.arsnova.entities; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + import java.io.Serializable; import java.util.Date; import java.util.List; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - /** * A question the teacher is asking. */ diff --git a/src/main/java/de/thm/arsnova/entities/Session.java b/src/main/java/de/thm/arsnova/entities/Session.java index a681dc2ab33e39e3e39c97e14f366c834a14b0ab..1da395b1b02170febe20520baa3aee52e525dbf6 100644 --- a/src/main/java/de/thm/arsnova/entities/Session.java +++ b/src/main/java/de/thm/arsnova/entities/Session.java @@ -17,12 +17,12 @@ */ package de.thm.arsnova.entities; -import java.io.Serializable; -import java.util.List; +import com.fasterxml.jackson.annotation.JsonIgnore; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import com.fasterxml.jackson.annotation.JsonIgnore; +import java.io.Serializable; +import java.util.List; /** * Represents an ARSnova session. diff --git a/src/main/java/de/thm/arsnova/entities/SessionInfo.java b/src/main/java/de/thm/arsnova/entities/SessionInfo.java index 20adc2d73474ed3be67eccbf295b58ff75f4618e..18f2e5e2273702f45c6a881cd3dbb1ba3db4cf4b 100644 --- a/src/main/java/de/thm/arsnova/entities/SessionInfo.java +++ b/src/main/java/de/thm/arsnova/entities/SessionInfo.java @@ -17,11 +17,12 @@ */ package de.thm.arsnova.entities; -import java.util.ArrayList; -import java.util.List; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; + /** * Summary information of a specific session. For example, this is used to display list entries of 'my sessions' as well * as 'my visited sessions'. diff --git a/src/main/java/de/thm/arsnova/entities/User.java b/src/main/java/de/thm/arsnova/entities/User.java index df8f0b7aad809b459134eb4ecfe359a319188f44..e883d5a1918292d7edb063f88c0ee39a9800e841 100644 --- a/src/main/java/de/thm/arsnova/entities/User.java +++ b/src/main/java/de/thm/arsnova/entities/User.java @@ -17,8 +17,7 @@ */ package de.thm.arsnova.entities; -import java.io.Serializable; - +import de.thm.arsnova.services.UserSessionService; import org.jasig.cas.client.authentication.AttributePrincipal; import org.scribe.up.profile.facebook.FacebookProfile; import org.scribe.up.profile.google.Google2Profile; @@ -26,7 +25,7 @@ import org.scribe.up.profile.twitter.TwitterProfile; import org.springframework.security.authentication.AnonymousAuthenticationToken; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; -import de.thm.arsnova.services.UserSessionService; +import java.io.Serializable; /** * Represents a user. diff --git a/src/main/java/de/thm/arsnova/entities/transport/Answer.java b/src/main/java/de/thm/arsnova/entities/transport/Answer.java index 1d208f60c10d91f849e13821a264a16906a19ef7..915d15f0a8b37c1248c95fe2fc572f732f943888 100644 --- a/src/main/java/de/thm/arsnova/entities/transport/Answer.java +++ b/src/main/java/de/thm/arsnova/entities/transport/Answer.java @@ -17,14 +17,13 @@ */ package de.thm.arsnova.entities.transport; -import java.util.Date; - import com.fasterxml.jackson.annotation.JsonInclude; +import de.thm.arsnova.entities.Question; +import de.thm.arsnova.entities.User; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import de.thm.arsnova.entities.Question; -import de.thm.arsnova.entities.User; +import java.util.Date; /** * A user's answer to a question. diff --git a/src/main/java/de/thm/arsnova/entities/transport/ImportExportSession.java b/src/main/java/de/thm/arsnova/entities/transport/ImportExportSession.java index a1c63621cdef8413f32acd9f7d6c5a7f15865718..a420af98f94f602502f67e514dadcaa4f424b91d 100644 --- a/src/main/java/de/thm/arsnova/entities/transport/ImportExportSession.java +++ b/src/main/java/de/thm/arsnova/entities/transport/ImportExportSession.java @@ -17,15 +17,15 @@ */ package de.thm.arsnova.entities.transport; -import java.util.Date; -import java.util.List; - import de.thm.arsnova.entities.Question; import de.thm.arsnova.entities.Session; import de.thm.arsnova.entities.User; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import java.util.Date; +import java.util.List; + /** * This class is used to allow the import and export of a session. */ diff --git a/src/main/java/de/thm/arsnova/entities/transport/InterposedQuestion.java b/src/main/java/de/thm/arsnova/entities/transport/InterposedQuestion.java index 0e06242348c300f229eadde4509c663e01ba2285..d950790c601f72ccbe831d4ec65df45cd99111d5 100644 --- a/src/main/java/de/thm/arsnova/entities/transport/InterposedQuestion.java +++ b/src/main/java/de/thm/arsnova/entities/transport/InterposedQuestion.java @@ -17,11 +17,12 @@ */ package de.thm.arsnova.entities.transport; -import java.util.ArrayList; -import java.util.List; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; + /** * A question a student is asking. Also known as feedback or audience question. */ diff --git a/src/main/java/de/thm/arsnova/events/DeleteFeedbackForSessionsEvent.java b/src/main/java/de/thm/arsnova/events/DeleteFeedbackForSessionsEvent.java index 54e233819aed20bd996fcb2a8c12ee53afdb0beb..af8fe019cd93d95240871166abdb0e3200913858 100644 --- a/src/main/java/de/thm/arsnova/events/DeleteFeedbackForSessionsEvent.java +++ b/src/main/java/de/thm/arsnova/events/DeleteFeedbackForSessionsEvent.java @@ -17,11 +17,11 @@ */ package de.thm.arsnova.events; -import java.util.Set; - import de.thm.arsnova.entities.Session; import de.thm.arsnova.entities.User; +import java.util.Set; + /** * Fires whenever the feedback of a specific user has been reset. */ diff --git a/src/main/java/de/thm/arsnova/events/LockQuestionsEvent.java b/src/main/java/de/thm/arsnova/events/LockQuestionsEvent.java index 0d382bbe1e4029ef608da5b004f0e0245f7519ec..f640e725130ae01bb467fe702a0d9db93778aaba 100644 --- a/src/main/java/de/thm/arsnova/events/LockQuestionsEvent.java +++ b/src/main/java/de/thm/arsnova/events/LockQuestionsEvent.java @@ -17,11 +17,11 @@ */ package de.thm.arsnova.events; -import java.util.List; - import de.thm.arsnova.entities.Question; import de.thm.arsnova.entities.Session; +import java.util.List; + /** * Fires whenever a set of questions are disabled, i.e., they are hidden from students. */ diff --git a/src/main/java/de/thm/arsnova/events/LockVoteEvent.java b/src/main/java/de/thm/arsnova/events/LockVoteEvent.java index 11167ff2356be54ce34e1361fbc13b8356d1cc9c..ea3c448b99cbf5c5e83c00d4887c6bef9ee9078a 100644 --- a/src/main/java/de/thm/arsnova/events/LockVoteEvent.java +++ b/src/main/java/de/thm/arsnova/events/LockVoteEvent.java @@ -17,11 +17,11 @@ */ package de.thm.arsnova.events; -import java.util.HashMap; - import de.thm.arsnova.entities.Question; import de.thm.arsnova.entities.Session; +import java.util.HashMap; + /** * Fires whenever voting on a question is disabled. */ diff --git a/src/main/java/de/thm/arsnova/events/LockVotesEvent.java b/src/main/java/de/thm/arsnova/events/LockVotesEvent.java index 58a47610c4ec64361b8e013ffdf6a2cdfb58fe4f..31c0fead4a40c95e8fbed6d299c589e25bcbc56c 100644 --- a/src/main/java/de/thm/arsnova/events/LockVotesEvent.java +++ b/src/main/java/de/thm/arsnova/events/LockVotesEvent.java @@ -17,11 +17,11 @@ */ package de.thm.arsnova.events; -import java.util.List; - import de.thm.arsnova.entities.Question; import de.thm.arsnova.entities.Session; +import java.util.List; + /** * Fires whenever voting of multiple questions is disabled. */ diff --git a/src/main/java/de/thm/arsnova/events/PiRoundDelayedStartEvent.java b/src/main/java/de/thm/arsnova/events/PiRoundDelayedStartEvent.java index df301caa22616bcedffad630887e0abb3a972e1e..72e57104cbc90d2b1fd478938ff86a36267e99b4 100644 --- a/src/main/java/de/thm/arsnova/events/PiRoundDelayedStartEvent.java +++ b/src/main/java/de/thm/arsnova/events/PiRoundDelayedStartEvent.java @@ -17,11 +17,11 @@ */ package de.thm.arsnova.events; -import java.util.HashMap; - import de.thm.arsnova.entities.Question; import de.thm.arsnova.entities.Session; +import java.util.HashMap; + /** * Fires whenever a delayed peer instruction round is initiated. The delayed part denotes that this round might not * have been started yet. diff --git a/src/main/java/de/thm/arsnova/events/PiRoundEndEvent.java b/src/main/java/de/thm/arsnova/events/PiRoundEndEvent.java index 16344c6ac717f1c5dd096beee28538a7da754cfa..a11768071eebe5504f1a7245c25064aa6b86b9e1 100644 --- a/src/main/java/de/thm/arsnova/events/PiRoundEndEvent.java +++ b/src/main/java/de/thm/arsnova/events/PiRoundEndEvent.java @@ -17,11 +17,11 @@ */ package de.thm.arsnova.events; -import java.util.HashMap; - import de.thm.arsnova.entities.Question; import de.thm.arsnova.entities.Session; +import java.util.HashMap; + /** * Fires whenever a peer instruction round has ended. */ diff --git a/src/main/java/de/thm/arsnova/events/PiRoundResetEvent.java b/src/main/java/de/thm/arsnova/events/PiRoundResetEvent.java index 626fd0e1f40b75d33db709e259abb86e5c062285..ed2328309a068317acab97927274b4ece47656f6 100644 --- a/src/main/java/de/thm/arsnova/events/PiRoundResetEvent.java +++ b/src/main/java/de/thm/arsnova/events/PiRoundResetEvent.java @@ -17,11 +17,11 @@ */ package de.thm.arsnova.events; -import java.util.HashMap; - import de.thm.arsnova.entities.Question; import de.thm.arsnova.entities.Session; +import java.util.HashMap; + /** * Fires whenever a peer instruction round is reset. */ diff --git a/src/main/java/de/thm/arsnova/events/UnlockQuestionsEvent.java b/src/main/java/de/thm/arsnova/events/UnlockQuestionsEvent.java index d8b6a5363b8bb5a0dfe7a295129b6125e1b183ac..2900e5288d8533b89c374d4d26fc1093fab1e999 100644 --- a/src/main/java/de/thm/arsnova/events/UnlockQuestionsEvent.java +++ b/src/main/java/de/thm/arsnova/events/UnlockQuestionsEvent.java @@ -17,11 +17,11 @@ */ package de.thm.arsnova.events; -import java.util.List; - import de.thm.arsnova.entities.Question; import de.thm.arsnova.entities.Session; +import java.util.List; + /** * Fires whenever a set of questions are enabled, i.e., they become visible to students. */ diff --git a/src/main/java/de/thm/arsnova/events/UnlockVoteEvent.java b/src/main/java/de/thm/arsnova/events/UnlockVoteEvent.java index 6eb0af7df5eb24d9ebe3b430c8c68bb988e7342d..8ebb498ca38420b4c5d65f764a52ffa7ce3ca954 100644 --- a/src/main/java/de/thm/arsnova/events/UnlockVoteEvent.java +++ b/src/main/java/de/thm/arsnova/events/UnlockVoteEvent.java @@ -17,11 +17,11 @@ */ package de.thm.arsnova.events; -import java.util.HashMap; - import de.thm.arsnova.entities.Question; import de.thm.arsnova.entities.Session; +import java.util.HashMap; + /** * Fires whenever voting on a question is enabled. */ diff --git a/src/main/java/de/thm/arsnova/events/UnlockVotesEvent.java b/src/main/java/de/thm/arsnova/events/UnlockVotesEvent.java index 231fef7b8c29d2d65752cf6574ba408d1b8c35d3..03655e3881ea5a3249bcdeba8956d35e696a4f29 100644 --- a/src/main/java/de/thm/arsnova/events/UnlockVotesEvent.java +++ b/src/main/java/de/thm/arsnova/events/UnlockVotesEvent.java @@ -17,11 +17,11 @@ */ package de.thm.arsnova.events; -import java.util.List; - import de.thm.arsnova.entities.Question; import de.thm.arsnova.entities.Session; +import java.util.List; + /** * Fires whenever voting of multiple questions is enabled. */ diff --git a/src/main/java/de/thm/arsnova/security/ApplicationPermissionEvaluator.java b/src/main/java/de/thm/arsnova/security/ApplicationPermissionEvaluator.java index f9f1227956436748ecffdb8293f505ff5f39bd06..2813ad74445164f0493ce5ca071c9d695d037ef4 100644 --- a/src/main/java/de/thm/arsnova/security/ApplicationPermissionEvaluator.java +++ b/src/main/java/de/thm/arsnova/security/ApplicationPermissionEvaluator.java @@ -17,29 +17,26 @@ */ package de.thm.arsnova.security; -import java.io.Serializable; - -import java.util.Arrays; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import com.github.leleuj.ss.oauth.client.authentication.OAuthAuthenticationToken; +import de.thm.arsnova.dao.IDatabaseDao; +import de.thm.arsnova.entities.InterposedQuestion; +import de.thm.arsnova.entities.Question; +import de.thm.arsnova.entities.Session; +import de.thm.arsnova.entities.User; +import de.thm.arsnova.exceptions.UnauthorizedException; import org.scribe.up.profile.facebook.FacebookProfile; import org.scribe.up.profile.google.Google2Profile; import org.scribe.up.profile.twitter.TwitterProfile; -import org.springframework.beans.factory.annotation.Value; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.security.access.PermissionEvaluator; import org.springframework.security.authentication.AnonymousAuthenticationToken; import org.springframework.security.core.Authentication; -import com.github.leleuj.ss.oauth.client.authentication.OAuthAuthenticationToken; - -import de.thm.arsnova.dao.IDatabaseDao; -import de.thm.arsnova.entities.InterposedQuestion; -import de.thm.arsnova.entities.Question; -import de.thm.arsnova.entities.Session; -import de.thm.arsnova.entities.User; -import de.thm.arsnova.exceptions.UnauthorizedException; +import java.io.Serializable; +import java.util.Arrays; /** * Provides access control methods that can be used in annotations. diff --git a/src/main/java/de/thm/arsnova/security/DbUserDetailsService.java b/src/main/java/de/thm/arsnova/security/DbUserDetailsService.java index 9eb476e8d794ee1d39e0ba17a02a71163e1220c0..c875f24d70a28e6e12c5680281d27b3f922e9690 100644 --- a/src/main/java/de/thm/arsnova/security/DbUserDetailsService.java +++ b/src/main/java/de/thm/arsnova/security/DbUserDetailsService.java @@ -17,9 +17,8 @@ */ package de.thm.arsnova.security; -import java.util.ArrayList; -import java.util.List; - +import de.thm.arsnova.dao.IDatabaseDao; +import de.thm.arsnova.entities.DbUser; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -31,8 +30,8 @@ import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.stereotype.Service; -import de.thm.arsnova.dao.IDatabaseDao; -import de.thm.arsnova.entities.DbUser; +import java.util.ArrayList; +import java.util.List; /** * Class to load a user based on the username. diff --git a/src/main/java/de/thm/arsnova/services/FeedbackService.java b/src/main/java/de/thm/arsnova/services/FeedbackService.java index 0d48aaad14a726fd569d7f5b24592992df69beb8..4f83e39cbefa9e3c564b49ad713dac99eebc6197 100644 --- a/src/main/java/de/thm/arsnova/services/FeedbackService.java +++ b/src/main/java/de/thm/arsnova/services/FeedbackService.java @@ -17,21 +17,6 @@ */ package de.thm.arsnova.services; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import javax.annotation.PostConstruct; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.ApplicationEventPublisher; -import org.springframework.context.ApplicationEventPublisherAware; -import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Service; - import de.thm.arsnova.FeedbackStorage; import de.thm.arsnova.dao.IDatabaseDao; import de.thm.arsnova.entities.Feedback; @@ -41,6 +26,19 @@ import de.thm.arsnova.events.DeleteFeedbackForSessionsEvent; import de.thm.arsnova.events.NewFeedbackEvent; import de.thm.arsnova.exceptions.NoContentException; import de.thm.arsnova.exceptions.NotFoundException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.ApplicationEventPublisher; +import org.springframework.context.ApplicationEventPublisherAware; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Service; + +import javax.annotation.PostConstruct; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; /** * Performs all feedback related operations. diff --git a/src/main/java/de/thm/arsnova/services/IMotdService.java b/src/main/java/de/thm/arsnova/services/IMotdService.java index d444a3adaa332047ec267316284ca7580da6b47c..5f046c1946a4c9ca5d2fa259b4824c0d4de289f1 100644 --- a/src/main/java/de/thm/arsnova/services/IMotdService.java +++ b/src/main/java/de/thm/arsnova/services/IMotdService.java @@ -17,14 +17,12 @@ */ package de.thm.arsnova.services; -import java.util.List; -import java.util.Date; -import java.util.Map; -import java.util.Set; - import de.thm.arsnova.entities.Motd; import de.thm.arsnova.entities.MotdList; +import java.util.Date; +import java.util.List; + /** * The functionality the motd service should provide. */ diff --git a/src/main/java/de/thm/arsnova/services/IQuestionService.java b/src/main/java/de/thm/arsnova/services/IQuestionService.java index b44a2f267c8160c8605aa0941da96cbe904d7ea1..4e4d414310c26bd390db91b45597036561be67cd 100644 --- a/src/main/java/de/thm/arsnova/services/IQuestionService.java +++ b/src/main/java/de/thm/arsnova/services/IQuestionService.java @@ -17,9 +17,6 @@ */ package de.thm.arsnova.services; -import java.util.List; -import java.util.Map; - import de.thm.arsnova.entities.Answer; import de.thm.arsnova.entities.InterposedQuestion; import de.thm.arsnova.entities.InterposedReadingCount; @@ -27,6 +24,9 @@ import de.thm.arsnova.entities.Question; import de.thm.arsnova.entities.SortOrder; import de.thm.arsnova.entities.User; +import java.util.List; +import java.util.Map; + /** * The functionality the question service should provide. */ diff --git a/src/main/java/de/thm/arsnova/services/ISessionService.java b/src/main/java/de/thm/arsnova/services/ISessionService.java index fa405d819138bb958af1ec7f6cec674a740ebc9b..89f6d7cc4997645bda472375a437e04c30621d16 100644 --- a/src/main/java/de/thm/arsnova/services/ISessionService.java +++ b/src/main/java/de/thm/arsnova/services/ISessionService.java @@ -17,9 +17,6 @@ */ package de.thm.arsnova.services; -import java.util.List; -import java.util.UUID; - import de.thm.arsnova.connector.model.Course; import de.thm.arsnova.entities.Session; import de.thm.arsnova.entities.SessionFeature; @@ -28,6 +25,9 @@ import de.thm.arsnova.entities.User; import de.thm.arsnova.entities.transport.ImportExportSession; import de.thm.arsnova.entities.transport.LearningProgressValues; +import java.util.List; +import java.util.UUID; + /** * The functionality the session service should provide. */ diff --git a/src/main/java/de/thm/arsnova/services/IUserService.java b/src/main/java/de/thm/arsnova/services/IUserService.java index 4049a48ac933280cabed6102a340fb6f460f7036..8db55089136e49dbc92d5997ebdeb1766ee550e7 100644 --- a/src/main/java/de/thm/arsnova/services/IUserService.java +++ b/src/main/java/de/thm/arsnova/services/IUserService.java @@ -17,13 +17,13 @@ */ package de.thm.arsnova.services; +import de.thm.arsnova.entities.DbUser; +import de.thm.arsnova.entities.User; + import java.util.Map; import java.util.Set; import java.util.UUID; -import de.thm.arsnova.entities.DbUser; -import de.thm.arsnova.entities.User; - /** * The functionality the user service should provide. */ diff --git a/src/main/java/de/thm/arsnova/services/MotdService.java b/src/main/java/de/thm/arsnova/services/MotdService.java index 8218af881430443eaf4a576b373385d2580c791b..beeb901af10c8b68da292e0dfddfc61d790d43e2 100644 --- a/src/main/java/de/thm/arsnova/services/MotdService.java +++ b/src/main/java/de/thm/arsnova/services/MotdService.java @@ -17,33 +17,21 @@ */ package de.thm.arsnova.services; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.List; -import java.util.Date; -import java.util.Set; -import java.util.HashSet; -import java.util.StringTokenizer; - +import de.thm.arsnova.dao.IDatabaseDao; +import de.thm.arsnova.entities.Motd; +import de.thm.arsnova.entities.MotdList; +import de.thm.arsnova.entities.User; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.ApplicationEventPublisher; -import org.springframework.context.ApplicationEventPublisherAware; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.stereotype.Service; -import de.thm.arsnova.dao.IDatabaseDao; -import de.thm.arsnova.entities.User; -import de.thm.arsnova.entities.Motd; -import de.thm.arsnova.entities.MotdList; -import de.thm.arsnova.exceptions.BadRequestException; -import de.thm.arsnova.exceptions.ForbiddenException; -import de.thm.arsnova.exceptions.NotFoundException; -import de.thm.arsnova.exceptions.PayloadTooLargeException; -import de.thm.arsnova.exceptions.UnauthorizedException; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashSet; +import java.util.List; +import java.util.StringTokenizer; /** * Performs all question, interposed question, and answer related operations. */ diff --git a/src/main/java/de/thm/arsnova/services/QuestionService.java b/src/main/java/de/thm/arsnova/services/QuestionService.java index c993f4ab947788b289a4a3212ca3db1f1b7dac9b..b8e46713dc6e127ddbc35a76087218e6259a79d8 100644 --- a/src/main/java/de/thm/arsnova/services/QuestionService.java +++ b/src/main/java/de/thm/arsnova/services/QuestionService.java @@ -17,25 +17,6 @@ */ package de.thm.arsnova.services; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.Hashtable; -import java.util.List; -import java.util.Map; -import java.util.Timer; -import java.util.TimerTask; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.ApplicationEventPublisher; -import org.springframework.context.ApplicationEventPublisherAware; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.stereotype.Service; - import de.thm.arsnova.ImageUtils; import de.thm.arsnova.dao.IDatabaseDao; import de.thm.arsnova.entities.Answer; @@ -45,33 +26,30 @@ import de.thm.arsnova.entities.Question; import de.thm.arsnova.entities.Session; import de.thm.arsnova.entities.SortOrder; import de.thm.arsnova.entities.User; -import de.thm.arsnova.events.DeleteAllLectureAnswersEvent; -import de.thm.arsnova.events.DeleteAllPreparationAnswersEvent; -import de.thm.arsnova.events.DeleteAllQuestionsAnswersEvent; -import de.thm.arsnova.events.DeleteAllQuestionsEvent; -import de.thm.arsnova.events.DeleteAnswerEvent; -import de.thm.arsnova.events.DeleteInterposedQuestionEvent; -import de.thm.arsnova.events.DeleteQuestionEvent; -import de.thm.arsnova.events.LockQuestionEvent; -import de.thm.arsnova.events.LockQuestionsEvent; -import de.thm.arsnova.events.LockVoteEvent; -import de.thm.arsnova.events.LockVotesEvent; -import de.thm.arsnova.events.NewAnswerEvent; -import de.thm.arsnova.events.NewInterposedQuestionEvent; -import de.thm.arsnova.events.NewQuestionEvent; -import de.thm.arsnova.events.UnlockQuestionEvent; -import de.thm.arsnova.events.UnlockQuestionsEvent; -import de.thm.arsnova.events.NovaEvent; -import de.thm.arsnova.events.PiRoundCancelEvent; -import de.thm.arsnova.events.PiRoundDelayedStartEvent; -import de.thm.arsnova.events.PiRoundEndEvent; -import de.thm.arsnova.events.PiRoundResetEvent; -import de.thm.arsnova.events.UnlockVoteEvent; -import de.thm.arsnova.events.UnlockVotesEvent; +import de.thm.arsnova.events.*; import de.thm.arsnova.exceptions.BadRequestException; import de.thm.arsnova.exceptions.ForbiddenException; import de.thm.arsnova.exceptions.NotFoundException; import de.thm.arsnova.exceptions.UnauthorizedException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.ApplicationEventPublisher; +import org.springframework.context.ApplicationEventPublisherAware; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.List; +import java.util.Map; +import java.util.Timer; +import java.util.TimerTask; /** * Performs all question, interposed question, and answer related operations. diff --git a/src/main/java/de/thm/arsnova/services/ResponseProviderServiceImpl.java b/src/main/java/de/thm/arsnova/services/ResponseProviderServiceImpl.java index d4791011599b9793ae82b8f32417690a49cc4ee8..e15954fb62d0688562373b91316999ceeafb82bb 100644 --- a/src/main/java/de/thm/arsnova/services/ResponseProviderServiceImpl.java +++ b/src/main/java/de/thm/arsnova/services/ResponseProviderServiceImpl.java @@ -17,12 +17,12 @@ */ package de.thm.arsnova.services; -import javax.servlet.http.HttpServletResponse; - import org.springframework.context.annotation.Scope; import org.springframework.context.annotation.ScopedProxyMode; import org.springframework.stereotype.Service; +import javax.servlet.http.HttpServletResponse; + @Service @Scope(value = "request", proxyMode = ScopedProxyMode.TARGET_CLASS) public class ResponseProviderServiceImpl implements ResponseProviderService { diff --git a/src/main/java/de/thm/arsnova/services/SessionService.java b/src/main/java/de/thm/arsnova/services/SessionService.java index e9e14221e8317e6b97f495cdadf0dda599d76a1f..7b36e3f267951954e0b1ad6433606ad9ae138481 100644 --- a/src/main/java/de/thm/arsnova/services/SessionService.java +++ b/src/main/java/de/thm/arsnova/services/SessionService.java @@ -17,21 +17,6 @@ */ package de.thm.arsnova.services; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.List; -import java.util.UUID; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.ApplicationEventPublisher; -import org.springframework.context.ApplicationEventPublisherAware; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.stereotype.Service; - import de.thm.arsnova.ImageUtils; import de.thm.arsnova.connector.client.ConnectorClient; import de.thm.arsnova.connector.model.Course; @@ -56,6 +41,20 @@ import de.thm.arsnova.exceptions.ForbiddenException; import de.thm.arsnova.exceptions.NotFoundException; import de.thm.arsnova.exceptions.PayloadTooLargeException; import de.thm.arsnova.exceptions.UnauthorizedException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.ApplicationEventPublisher; +import org.springframework.context.ApplicationEventPublisherAware; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.stereotype.Service; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; +import java.util.UUID; /** * Performs all session related operations. @@ -444,8 +443,8 @@ public class SessionService implements ISessionService, ApplicationEventPublishe } /** - * - * @param session + * + * @param session * @throws PayloadTooLargeException * @throws BadRequestException */ diff --git a/src/main/java/de/thm/arsnova/services/StatisticsService.java b/src/main/java/de/thm/arsnova/services/StatisticsService.java index ace061a60e86e771eefe6b01e623b4fa78f963bf..c219336ecb420d7f4a6da81be9bc48fb819c6d1d 100644 --- a/src/main/java/de/thm/arsnova/services/StatisticsService.java +++ b/src/main/java/de/thm/arsnova/services/StatisticsService.java @@ -17,11 +17,10 @@ */ package de.thm.arsnova.services; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - import de.thm.arsnova.dao.IDatabaseDao; import de.thm.arsnova.entities.Statistics; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; /** * Performs all statistics related operations. diff --git a/src/main/java/de/thm/arsnova/services/UserService.java b/src/main/java/de/thm/arsnova/services/UserService.java index aa4be5e5619dff32c8f3c445e8b6b234ebc65e43..d70c4a03cd149dc0994bd4f4f39cbcd6a21a032c 100644 --- a/src/main/java/de/thm/arsnova/services/UserService.java +++ b/src/main/java/de/thm/arsnova/services/UserService.java @@ -17,24 +17,13 @@ */ package de.thm.arsnova.services; -import java.io.UnsupportedEncodingException; -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.ConcurrentHashMap; -import java.util.regex.Pattern; - -import javax.annotation.PreDestroy; -import javax.mail.MessagingException; -import javax.mail.internet.MimeMessage; - +import com.github.leleuj.ss.oauth.client.authentication.OAuthAuthenticationToken; +import de.thm.arsnova.dao.IDatabaseDao; +import de.thm.arsnova.entities.DbUser; +import de.thm.arsnova.entities.User; +import de.thm.arsnova.exceptions.BadRequestException; +import de.thm.arsnova.exceptions.NotFoundException; +import de.thm.arsnova.exceptions.UnauthorizedException; import org.apache.commons.lang.RandomStringUtils; import org.apache.commons.lang.StringUtils; import org.scribe.up.profile.facebook.FacebookProfile; @@ -62,14 +51,22 @@ import org.springframework.transaction.annotation.Isolation; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.util.UriUtils; -import com.github.leleuj.ss.oauth.client.authentication.OAuthAuthenticationToken; - -import de.thm.arsnova.dao.IDatabaseDao; -import de.thm.arsnova.entities.DbUser; -import de.thm.arsnova.entities.User; -import de.thm.arsnova.exceptions.BadRequestException; -import de.thm.arsnova.exceptions.NotFoundException; -import de.thm.arsnova.exceptions.UnauthorizedException; +import javax.annotation.PreDestroy; +import javax.mail.MessagingException; +import javax.mail.internet.MimeMessage; +import java.io.UnsupportedEncodingException; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.ConcurrentHashMap; +import java.util.regex.Pattern; /** * Performs all user related operations. diff --git a/src/main/java/de/thm/arsnova/services/UserSessionService.java b/src/main/java/de/thm/arsnova/services/UserSessionService.java index 03df6b27079c635944a3c0ef02c05edb63b59559..12c4a0f2a684af696d4a4f3f7e95f47546f533f9 100644 --- a/src/main/java/de/thm/arsnova/services/UserSessionService.java +++ b/src/main/java/de/thm/arsnova/services/UserSessionService.java @@ -17,11 +17,11 @@ */ package de.thm.arsnova.services; -import java.util.UUID; - import de.thm.arsnova.entities.Session; import de.thm.arsnova.entities.User; +import java.util.UUID; + /** * The functionality the user-session service should provide. */ diff --git a/src/main/java/de/thm/arsnova/services/UserSessionServiceImpl.java b/src/main/java/de/thm/arsnova/services/UserSessionServiceImpl.java index 98f817773b670a185dac4875014095e178ce9dd5..2801f4b53169c1474c0b196822bd0142ac9593d0 100644 --- a/src/main/java/de/thm/arsnova/services/UserSessionServiceImpl.java +++ b/src/main/java/de/thm/arsnova/services/UserSessionServiceImpl.java @@ -17,15 +17,14 @@ */ package de.thm.arsnova.services; -import java.io.Serializable; -import java.util.UUID; - +import de.thm.arsnova.entities.Session; +import de.thm.arsnova.entities.User; import org.springframework.context.annotation.Scope; import org.springframework.context.annotation.ScopedProxyMode; import org.springframework.stereotype.Component; -import de.thm.arsnova.entities.Session; -import de.thm.arsnova.entities.User; +import java.io.Serializable; +import java.util.UUID; /** * This service is used to assign and check for a specific role. diff --git a/src/main/java/de/thm/arsnova/socket/ARSnovaSocketIOServer.java b/src/main/java/de/thm/arsnova/socket/ARSnovaSocketIOServer.java index 24b5644a17e4d34193c44a3c44737de2d789f526..0ae3d43007898bd6b06487754f18d8bcde281f53 100644 --- a/src/main/java/de/thm/arsnova/socket/ARSnovaSocketIOServer.java +++ b/src/main/java/de/thm/arsnova/socket/ARSnovaSocketIOServer.java @@ -17,25 +17,6 @@ */ package de.thm.arsnova.socket; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map.Entry; -import java.util.Set; -import java.util.UUID; - -import javax.annotation.PreDestroy; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Required; -import org.springframework.scheduling.annotation.Async; -import org.springframework.stereotype.Component; - import com.corundumstudio.socketio.AckRequest; import com.corundumstudio.socketio.Configuration; import com.corundumstudio.socketio.SocketConfig; @@ -46,41 +27,10 @@ import com.corundumstudio.socketio.listener.DataListener; import com.corundumstudio.socketio.listener.DisconnectListener; import com.corundumstudio.socketio.protocol.Packet; import com.corundumstudio.socketio.protocol.PacketType; - import de.thm.arsnova.entities.InterposedQuestion; import de.thm.arsnova.entities.User; import de.thm.arsnova.entities.transport.LearningProgressOptions; -import de.thm.arsnova.events.ChangeLearningProgressEvent; -import de.thm.arsnova.events.DeleteAllLectureAnswersEvent; -import de.thm.arsnova.events.DeleteAllPreparationAnswersEvent; -import de.thm.arsnova.events.DeleteAllQuestionsAnswersEvent; -import de.thm.arsnova.events.DeleteAllQuestionsEvent; -import de.thm.arsnova.events.DeleteAnswerEvent; -import de.thm.arsnova.events.DeleteFeedbackForSessionsEvent; -import de.thm.arsnova.events.DeleteInterposedQuestionEvent; -import de.thm.arsnova.events.DeleteQuestionEvent; -import de.thm.arsnova.events.DeleteSessionEvent; -import de.thm.arsnova.events.FeatureChangeEvent; -import de.thm.arsnova.events.LockFeedbackEvent; -import de.thm.arsnova.events.LockQuestionEvent; -import de.thm.arsnova.events.LockQuestionsEvent; -import de.thm.arsnova.events.LockVoteEvent; -import de.thm.arsnova.events.LockVotesEvent; -import de.thm.arsnova.events.NewAnswerEvent; -import de.thm.arsnova.events.NewFeedbackEvent; -import de.thm.arsnova.events.NewInterposedQuestionEvent; -import de.thm.arsnova.events.NewQuestionEvent; -import de.thm.arsnova.events.UnlockQuestionEvent; -import de.thm.arsnova.events.UnlockQuestionsEvent; -import de.thm.arsnova.events.NewSessionEvent; -import de.thm.arsnova.events.NovaEventVisitor; -import de.thm.arsnova.events.PiRoundCancelEvent; -import de.thm.arsnova.events.PiRoundDelayedStartEvent; -import de.thm.arsnova.events.PiRoundEndEvent; -import de.thm.arsnova.events.PiRoundResetEvent; -import de.thm.arsnova.events.StatusSessionEvent; -import de.thm.arsnova.events.UnlockVoteEvent; -import de.thm.arsnova.events.UnlockVotesEvent; +import de.thm.arsnova.events.*; import de.thm.arsnova.exceptions.NoContentException; import de.thm.arsnova.exceptions.NotFoundException; import de.thm.arsnova.exceptions.UnauthorizedException; @@ -91,6 +41,23 @@ import de.thm.arsnova.services.IUserService; import de.thm.arsnova.socket.message.Feedback; import de.thm.arsnova.socket.message.Question; import de.thm.arsnova.socket.message.Session; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Required; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Component; + +import javax.annotation.PreDestroy; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map.Entry; +import java.util.Set; +import java.util.UUID; /** * Web socket implementation based on Socket.io. diff --git a/src/main/java/de/thm/arsnova/socket/ARSnovaSocketListener.java b/src/main/java/de/thm/arsnova/socket/ARSnovaSocketListener.java index 38ebc23ecc78b103ff3a579f132629c54a35be44..93cbb0e7c573023a5de989a168300ff6d610dc3b 100644 --- a/src/main/java/de/thm/arsnova/socket/ARSnovaSocketListener.java +++ b/src/main/java/de/thm/arsnova/socket/ARSnovaSocketListener.java @@ -17,13 +17,12 @@ */ package de.thm.arsnova.socket; +import de.thm.arsnova.events.NovaEvent; +import de.thm.arsnova.events.NovaEventVisitor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationListener; import org.springframework.stereotype.Component; -import de.thm.arsnova.events.NovaEvent; -import de.thm.arsnova.events.NovaEventVisitor; - /** * An external Listener is required because otherwise the event methods are not called through a Spring proxy. * This would result in Spring method annotations not working. diff --git a/src/main/java/de/thm/arsnova/web/CacheControlInterceptorHandler.java b/src/main/java/de/thm/arsnova/web/CacheControlInterceptorHandler.java index 7c721d6a720cdd641e46c15798a71627bc2defed..8357020d77dbf1087564a530619b63f4ba862203 100644 --- a/src/main/java/de/thm/arsnova/web/CacheControlInterceptorHandler.java +++ b/src/main/java/de/thm/arsnova/web/CacheControlInterceptorHandler.java @@ -17,13 +17,13 @@ */ package de.thm.arsnova.web; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - import org.springframework.stereotype.Component; import org.springframework.web.method.HandlerMethod; import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + /** * Adds caching headers to a HTTP request based on {@link CacheControl} annotation. */ diff --git a/src/main/java/de/thm/arsnova/web/CorsFilter.java b/src/main/java/de/thm/arsnova/web/CorsFilter.java index 96d935c07b646f10192962eb9ef0f40f1c63bbc8..1b18de705c0cf6167ed3c7e0d9f6e0e1d4c5b998 100644 --- a/src/main/java/de/thm/arsnova/web/CorsFilter.java +++ b/src/main/java/de/thm/arsnova/web/CorsFilter.java @@ -17,15 +17,14 @@ */ package de.thm.arsnova.web; -import java.io.IOException; +import org.springframework.stereotype.Component; +import org.springframework.web.filter.OncePerRequestFilter; import javax.servlet.FilterChain; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; - -import org.springframework.stereotype.Component; -import org.springframework.web.filter.OncePerRequestFilter; +import java.io.IOException; /** * Sets response headers to allow CORS requests. diff --git a/src/main/java/de/thm/arsnova/web/DeprecatedApiInterceptorHandler.java b/src/main/java/de/thm/arsnova/web/DeprecatedApiInterceptorHandler.java index d7b7d81078269eebd45b80a52b6673f8aa95a2c7..63730cb1337ced75cd09644b5fa399b4bae70f14 100644 --- a/src/main/java/de/thm/arsnova/web/DeprecatedApiInterceptorHandler.java +++ b/src/main/java/de/thm/arsnova/web/DeprecatedApiInterceptorHandler.java @@ -17,13 +17,13 @@ */ package de.thm.arsnova.web; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - import org.springframework.stereotype.Component; import org.springframework.web.method.HandlerMethod; import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + /** * Adds a "deprecated" header to any HTTP response that is served by a controller method with the {@link DeprecatedApi} * annotation. diff --git a/src/main/java/de/thm/arsnova/web/ResponseInterceptorHandler.java b/src/main/java/de/thm/arsnova/web/ResponseInterceptorHandler.java index 15e157c01a3b2b68814d23c06fbc55c1be4eb977..9c8bb916ceeed893821a5b27f07bda7f2aecf647 100644 --- a/src/main/java/de/thm/arsnova/web/ResponseInterceptorHandler.java +++ b/src/main/java/de/thm/arsnova/web/ResponseInterceptorHandler.java @@ -17,14 +17,13 @@ */ package de.thm.arsnova.web; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - +import de.thm.arsnova.services.ResponseProviderService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; -import de.thm.arsnova.services.ResponseProviderService; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; /** * Injects a {@link HttpServletResponse} into {@link ResponseProviderService} to allow access to it outside of diff --git a/src/main/webapp/WEB-INF/web-dev.xml b/src/main/webapp/WEB-INF/web-dev.xml index a3fd6e96c9fc71f4b592ca5098319f1f6cde9f41..bd683b80d0a48299571c210cf0f45fff4d91babc 100644 --- a/src/main/webapp/WEB-INF/web-dev.xml +++ b/src/main/webapp/WEB-INF/web-dev.xml @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" - xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" - id="WebApp_ID" version="3.0"> + xmlns="http://java.sun.com/xml/ns/javaee" + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" + id="WebApp_ID" version="3.0"> <context-param> <param-name>log4jConfigLocation</param-name> <param-value>/WEB-INF/classes/log4j-dev.properties</param-value> diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml index 9c71a5a4a2233deb0bc848ee71fd5aa8356532dc..7daa0e4c21695641e954b8e1b98c8239c3c9e33a 100644 --- a/src/main/webapp/WEB-INF/web.xml +++ b/src/main/webapp/WEB-INF/web.xml @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" - xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" - id="WebApp_ID" version="3.0"> + xmlns="http://java.sun.com/xml/ns/javaee" + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" + id="WebApp_ID" version="3.0"> <context-param> <param-name>contextConfigLocation</param-name> <param-value> diff --git a/src/test/java/de/thm/arsnova/ImageUtilsTest.java b/src/test/java/de/thm/arsnova/ImageUtilsTest.java index e3159b23318ce1cdae661dd94d11d6dd677f7b47..b9a8e9ee7b397e16fd645aaebdb565dd9d5dfcff 100644 --- a/src/test/java/de/thm/arsnova/ImageUtilsTest.java +++ b/src/test/java/de/thm/arsnova/ImageUtilsTest.java @@ -1,22 +1,19 @@ package de.thm.arsnova; -import de.thm.arsnova.ImageUtils; -import static de.thm.arsnova.ImageUtils.IMAGE_PREFIX_START; -import static de.thm.arsnova.ImageUtils.IMAGE_PREFIX_MIDDLE; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertEquals; import org.junit.Test; import org.junit.runner.RunWith; - -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.web.WebAppConfiguration; +import static de.thm.arsnova.ImageUtils.IMAGE_PREFIX_MIDDLE; +import static de.thm.arsnova.ImageUtils.IMAGE_PREFIX_START; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + @RunWith(SpringJUnit4ClassRunner.class) @WebAppConfiguration @ContextConfiguration(locations = { diff --git a/src/test/java/de/thm/arsnova/config/ExtraConfigTest.java b/src/test/java/de/thm/arsnova/config/ExtraConfigTest.java index ee37027f0305a545d8c0e5a2c9d32c32bc062f1f..1a5e3b5be57b6b85f044cadbf245ad9cd13c4891 100644 --- a/src/test/java/de/thm/arsnova/config/ExtraConfigTest.java +++ b/src/test/java/de/thm/arsnova/config/ExtraConfigTest.java @@ -1,7 +1,6 @@ package de.thm.arsnova.config; -import static org.junit.Assert.assertNull; - +import de.thm.arsnova.connector.client.ConnectorClient; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; @@ -10,7 +9,7 @@ import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.web.WebAppConfiguration; -import de.thm.arsnova.connector.client.ConnectorClient; +import static org.junit.Assert.assertNull; @RunWith(SpringJUnit4ClassRunner.class) @WebAppConfiguration diff --git a/src/test/java/de/thm/arsnova/config/TestSecurityConfig.java b/src/test/java/de/thm/arsnova/config/TestSecurityConfig.java index 9aa848ea67194afb7f16ab13664cef3bf27ff3ba..9eb4d89bd0a0a8c861490525860de58847bb707e 100644 --- a/src/test/java/de/thm/arsnova/config/TestSecurityConfig.java +++ b/src/test/java/de/thm/arsnova/config/TestSecurityConfig.java @@ -1,5 +1,9 @@ package de.thm.arsnova.config; +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.OAuthAuthenticationFilter; +import de.thm.arsnova.CasUserDetailsService; import org.jasig.cas.client.validation.Cas20ProxyTicketValidator; import org.scribe.up.provider.impl.FacebookProvider; import org.scribe.up.provider.impl.Google2Provider; @@ -19,12 +23,6 @@ import org.springframework.security.config.annotation.web.configuration.EnableWe import org.springframework.security.core.session.SessionRegistry; import org.springframework.security.core.session.SessionRegistryImpl; -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.OAuthAuthenticationFilter; - -import de.thm.arsnova.CasUserDetailsService; - @Configuration @EnableGlobalMethodSecurity(prePostEnabled = true) @EnableWebSecurity diff --git a/src/test/java/de/thm/arsnova/controller/AbstractControllerTest.java b/src/test/java/de/thm/arsnova/controller/AbstractControllerTest.java index 68c93365575feba73da179dff3d6a8a16333c3a2..80617d0d618f8b99b36b1e11245c0a95012e98c1 100644 --- a/src/test/java/de/thm/arsnova/controller/AbstractControllerTest.java +++ b/src/test/java/de/thm/arsnova/controller/AbstractControllerTest.java @@ -1,15 +1,14 @@ package de.thm.arsnova.controller; -import java.util.ArrayList; -import java.util.List; - +import de.thm.arsnova.services.StubUserService; import org.junit.After; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.context.SecurityContextHolder; -import de.thm.arsnova.services.StubUserService; +import java.util.ArrayList; +import java.util.List; public abstract class AbstractControllerTest { diff --git a/src/test/java/de/thm/arsnova/controller/CourseControllerTest.java b/src/test/java/de/thm/arsnova/controller/CourseControllerTest.java index 279d8248d4621ff3c849243d313eb51b42a1db6e..7ced5c66eb27736a05b4232ebccc3583aa817aeb 100644 --- a/src/test/java/de/thm/arsnova/controller/CourseControllerTest.java +++ b/src/test/java/de/thm/arsnova/controller/CourseControllerTest.java @@ -1,11 +1,7 @@ package de.thm.arsnova.controller; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -import java.util.ArrayList; -import java.util.List; - +import de.thm.arsnova.connector.client.ConnectorClient; +import de.thm.arsnova.services.StubUserService; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -24,8 +20,11 @@ import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.web.context.WebApplicationContext; -import de.thm.arsnova.connector.client.ConnectorClient; -import de.thm.arsnova.services.StubUserService; +import java.util.ArrayList; +import java.util.List; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @RunWith(SpringJUnit4ClassRunner.class) @WebAppConfiguration diff --git a/src/test/java/de/thm/arsnova/controller/FeedbackControllerTest.java b/src/test/java/de/thm/arsnova/controller/FeedbackControllerTest.java index 610fbca29dfdbab59f496f96d3cc23761925616e..25d823a9a157917f38d39979bdfd59faf311fd78 100644 --- a/src/test/java/de/thm/arsnova/controller/FeedbackControllerTest.java +++ b/src/test/java/de/thm/arsnova/controller/FeedbackControllerTest.java @@ -1,11 +1,6 @@ package de.thm.arsnova.controller; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - +import de.thm.arsnova.services.StubUserService; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -19,7 +14,11 @@ import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.web.context.WebApplicationContext; -import de.thm.arsnova.services.StubUserService; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @RunWith(SpringJUnit4ClassRunner.class) @WebAppConfiguration diff --git a/src/test/java/de/thm/arsnova/controller/LecturerQuestionControllerTest.java b/src/test/java/de/thm/arsnova/controller/LecturerQuestionControllerTest.java index a4977f7f9f11436967dc1298394371b045c8c65a..5a227e246ea4886d6affb3936ab89d09ac01d9f5 100644 --- a/src/test/java/de/thm/arsnova/controller/LecturerQuestionControllerTest.java +++ b/src/test/java/de/thm/arsnova/controller/LecturerQuestionControllerTest.java @@ -1,13 +1,6 @@ package de.thm.arsnova.controller; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -import java.util.ArrayList; -import java.util.List; - +import de.thm.arsnova.services.StubUserService; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -25,7 +18,13 @@ import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.web.context.WebApplicationContext; -import de.thm.arsnova.services.StubUserService; +import java.util.ArrayList; +import java.util.List; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @RunWith(SpringJUnit4ClassRunner.class) @WebAppConfiguration diff --git a/src/test/java/de/thm/arsnova/controller/LoginControllerTest.java b/src/test/java/de/thm/arsnova/controller/LoginControllerTest.java index 7c8880cc9c3412a6438b3b2f6f034178cd3d53d4..283a4d2e6a2c6f197f3406863bd41dc283f0328c 100644 --- a/src/test/java/de/thm/arsnova/controller/LoginControllerTest.java +++ b/src/test/java/de/thm/arsnova/controller/LoginControllerTest.java @@ -18,13 +18,7 @@ */ package de.thm.arsnova.controller; -import static org.junit.Assert.assertEquals; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.redirectedUrl; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - +import de.thm.arsnova.services.StubUserService; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -41,7 +35,12 @@ import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.web.context.WebApplicationContext; -import de.thm.arsnova.services.StubUserService; +import static org.junit.Assert.assertEquals; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.redirectedUrl; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @RunWith(SpringJUnit4ClassRunner.class) @WebAppConfiguration diff --git a/src/test/java/de/thm/arsnova/controller/SessionControllerTest.java b/src/test/java/de/thm/arsnova/controller/SessionControllerTest.java index 8edf5f1141a3c74caf929d6780923a9498cbf94f..e2252511ad423452e59cebeadb2acfc5ed12c082 100644 --- a/src/test/java/de/thm/arsnova/controller/SessionControllerTest.java +++ b/src/test/java/de/thm/arsnova/controller/SessionControllerTest.java @@ -1,16 +1,6 @@ package de.thm.arsnova.controller; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -import java.util.ArrayList; -import java.util.List; - +import de.thm.arsnova.services.StubUserService; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -28,7 +18,16 @@ import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.web.context.WebApplicationContext; -import de.thm.arsnova.services.StubUserService; +import java.util.ArrayList; +import java.util.List; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @RunWith(SpringJUnit4ClassRunner.class) @WebAppConfiguration diff --git a/src/test/java/de/thm/arsnova/controller/StatisticsControllerTest.java b/src/test/java/de/thm/arsnova/controller/StatisticsControllerTest.java index 8fff3582094ab1f5ca88019b49735d6688ab584b..8358dc3b0d46bebfda382082f80b06c9fff91f18 100644 --- a/src/test/java/de/thm/arsnova/controller/StatisticsControllerTest.java +++ b/src/test/java/de/thm/arsnova/controller/StatisticsControllerTest.java @@ -1,11 +1,5 @@ package de.thm.arsnova.controller; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -19,6 +13,12 @@ import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.web.context.WebApplicationContext; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + @RunWith(SpringJUnit4ClassRunner.class) @WebAppConfiguration @ContextConfiguration(locations = { diff --git a/src/test/java/de/thm/arsnova/dao/NovaViewTest.java b/src/test/java/de/thm/arsnova/dao/NovaViewTest.java index 2e655146890be853c784f32b0bdf2be90f618c1a..ff0d818663ec733b6b04a6d65c29ba68a7c46b34 100644 --- a/src/test/java/de/thm/arsnova/dao/NovaViewTest.java +++ b/src/test/java/de/thm/arsnova/dao/NovaViewTest.java @@ -18,15 +18,16 @@ */ package de.thm.arsnova.dao; -import static org.junit.Assert.*; +import com.fourspaces.couchdb.View.StaleMode; +import org.junit.Test; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.util.Arrays; -import org.junit.Test; - -import com.fourspaces.couchdb.View.StaleMode; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.fail; public class NovaViewTest { diff --git a/src/test/java/de/thm/arsnova/dao/StubDatabaseDao.java b/src/test/java/de/thm/arsnova/dao/StubDatabaseDao.java index 6a5e369cf4549771ed9da4d53cc1d982cc129478..16a7ecd5e7d610eca00f6fa71a199af86f119055 100644 --- a/src/test/java/de/thm/arsnova/dao/StubDatabaseDao.java +++ b/src/test/java/de/thm/arsnova/dao/StubDatabaseDao.java @@ -18,11 +18,6 @@ */ package de.thm.arsnova.dao; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - import de.thm.arsnova.connector.model.Course; import de.thm.arsnova.domain.CourseScore; import de.thm.arsnova.entities.Answer; @@ -31,18 +26,23 @@ import de.thm.arsnova.entities.Feedback; import de.thm.arsnova.entities.InterposedQuestion; import de.thm.arsnova.entities.InterposedReadingCount; import de.thm.arsnova.entities.LoggedIn; +import de.thm.arsnova.entities.Motd; +import de.thm.arsnova.entities.MotdList; import de.thm.arsnova.entities.Question; import de.thm.arsnova.entities.Session; import de.thm.arsnova.entities.SessionInfo; import de.thm.arsnova.entities.SortOrder; import de.thm.arsnova.entities.Statistics; import de.thm.arsnova.entities.User; -import de.thm.arsnova.entities.Motd; -import de.thm.arsnova.entities.MotdList; import de.thm.arsnova.entities.transport.ImportExportSession; import de.thm.arsnova.exceptions.NoContentException; import de.thm.arsnova.exceptions.NotFoundException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + public class StubDatabaseDao implements IDatabaseDao { private static Map<String, Session> stubSessions = new ConcurrentHashMap<String, Session>(); diff --git a/src/test/java/de/thm/arsnova/domain/PointBasedLearningProgressTest.java b/src/test/java/de/thm/arsnova/domain/PointBasedLearningProgressTest.java index 557ce198bd5898b13a2c7bb95bdd43760d21fc3b..fc75845916d057c49576249829d6a7b280e25787 100644 --- a/src/test/java/de/thm/arsnova/domain/PointBasedLearningProgressTest.java +++ b/src/test/java/de/thm/arsnova/domain/PointBasedLearningProgressTest.java @@ -17,17 +17,16 @@ */ package de.thm.arsnova.domain; -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import org.junit.Before; -import org.junit.Test; - import de.thm.arsnova.dao.IDatabaseDao; import de.thm.arsnova.entities.TestUser; import de.thm.arsnova.entities.User; import de.thm.arsnova.entities.transport.LearningProgressValues; +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; public class PointBasedLearningProgressTest { diff --git a/src/test/java/de/thm/arsnova/domain/QuestionBasedLearningProgressTest.java b/src/test/java/de/thm/arsnova/domain/QuestionBasedLearningProgressTest.java index 1efbde1cd05473aae781560ebd73ce954dcb6798..47d907da5597c2ecbedf36eeb47e4dacf37a6307 100644 --- a/src/test/java/de/thm/arsnova/domain/QuestionBasedLearningProgressTest.java +++ b/src/test/java/de/thm/arsnova/domain/QuestionBasedLearningProgressTest.java @@ -17,16 +17,16 @@ */ package de.thm.arsnova.domain; -import static org.mockito.Mockito.*; -import static org.junit.Assert.*; - -import org.junit.Before; -import org.junit.Test; - import de.thm.arsnova.dao.IDatabaseDao; import de.thm.arsnova.entities.TestUser; import de.thm.arsnova.entities.User; import de.thm.arsnova.entities.transport.LearningProgressValues; +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; public class QuestionBasedLearningProgressTest { diff --git a/src/test/java/de/thm/arsnova/entities/FeedbackTest.java b/src/test/java/de/thm/arsnova/entities/FeedbackTest.java index 07e9db7c992b262d8d29d3ce84eb1d29684c209e..21ffffbba0d632bcb3fdde51c8fd862638345055 100644 --- a/src/test/java/de/thm/arsnova/entities/FeedbackTest.java +++ b/src/test/java/de/thm/arsnova/entities/FeedbackTest.java @@ -18,11 +18,11 @@ */ package de.thm.arsnova.entities; +import org.junit.Test; + import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; -import org.junit.Test; - public class FeedbackTest { @Test diff --git a/src/test/java/de/thm/arsnova/entities/QuestionTest.java b/src/test/java/de/thm/arsnova/entities/QuestionTest.java index d75ab04218a3d7864912d80856c5203e5969f948..cb38673425ce490b64c1908afc2636d9f8c968cc 100644 --- a/src/test/java/de/thm/arsnova/entities/QuestionTest.java +++ b/src/test/java/de/thm/arsnova/entities/QuestionTest.java @@ -1,10 +1,10 @@ package de.thm.arsnova.entities; -import static org.junit.Assert.assertEquals; +import org.junit.Test; import java.util.ArrayList; -import org.junit.Test; +import static org.junit.Assert.assertEquals; public class QuestionTest { diff --git a/src/test/java/de/thm/arsnova/services/FeedbackServiceTest.java b/src/test/java/de/thm/arsnova/services/FeedbackServiceTest.java index 90428ee02c4932b83f09d6578748e10f40d3c1e9..762ef91d98f00fed7579a2bd86f632aac6f93ccd 100644 --- a/src/test/java/de/thm/arsnova/services/FeedbackServiceTest.java +++ b/src/test/java/de/thm/arsnova/services/FeedbackServiceTest.java @@ -18,9 +18,10 @@ */ package de.thm.arsnova.services; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - +import de.thm.arsnova.dao.StubDatabaseDao; +import de.thm.arsnova.entities.TestUser; +import de.thm.arsnova.exceptions.NoContentException; +import de.thm.arsnova.exceptions.NotFoundException; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -31,10 +32,8 @@ import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.web.WebAppConfiguration; -import de.thm.arsnova.dao.StubDatabaseDao; -import de.thm.arsnova.entities.TestUser; -import de.thm.arsnova.exceptions.NoContentException; -import de.thm.arsnova.exceptions.NotFoundException; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; @WebAppConfiguration @RunWith(SpringJUnit4ClassRunner.class) diff --git a/src/test/java/de/thm/arsnova/services/QuestionServiceTest.java b/src/test/java/de/thm/arsnova/services/QuestionServiceTest.java index d7d987780343aa6dd7b9a1faae28fd85257cd50b..a5e0ef5c25bb85fda0cab9432e38c4480dfcf541 100644 --- a/src/test/java/de/thm/arsnova/services/QuestionServiceTest.java +++ b/src/test/java/de/thm/arsnova/services/QuestionServiceTest.java @@ -18,13 +18,10 @@ */ package de.thm.arsnova.services; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -import java.util.ArrayList; -import java.util.List; - +import de.thm.arsnova.dao.StubDatabaseDao; +import de.thm.arsnova.entities.InterposedQuestion; +import de.thm.arsnova.entities.Question; +import de.thm.arsnova.exceptions.NotFoundException; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -40,10 +37,12 @@ import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.web.WebAppConfiguration; -import de.thm.arsnova.dao.StubDatabaseDao; -import de.thm.arsnova.entities.InterposedQuestion; -import de.thm.arsnova.entities.Question; -import de.thm.arsnova.exceptions.NotFoundException; +import java.util.ArrayList; +import java.util.List; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; @WebAppConfiguration @RunWith(SpringJUnit4ClassRunner.class) diff --git a/src/test/java/de/thm/arsnova/services/SessionServiceTest.java b/src/test/java/de/thm/arsnova/services/SessionServiceTest.java index df5f35c80606e170e487ffdf19ac423f6ec86e1c..56671c0f818cf2ee77a9ac3d0c562973689eded6 100644 --- a/src/test/java/de/thm/arsnova/services/SessionServiceTest.java +++ b/src/test/java/de/thm/arsnova/services/SessionServiceTest.java @@ -18,18 +18,10 @@ */ package de.thm.arsnova.services; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.Comparator; -import java.util.List; - +import de.thm.arsnova.dao.IDatabaseDao; +import de.thm.arsnova.dao.StubDatabaseDao; +import de.thm.arsnova.entities.Session; +import de.thm.arsnova.exceptions.NotFoundException; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -45,13 +37,20 @@ import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.util.ReflectionTestUtils; import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.util.ReflectionTestUtils; -import de.thm.arsnova.dao.IDatabaseDao; -import de.thm.arsnova.dao.StubDatabaseDao; -import de.thm.arsnova.entities.Session; -import de.thm.arsnova.exceptions.NotFoundException; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; @WebAppConfiguration @RunWith(SpringJUnit4ClassRunner.class) diff --git a/src/test/java/de/thm/arsnova/services/StubUserService.java b/src/test/java/de/thm/arsnova/services/StubUserService.java index 6132a089f66bcd55ffc47bcacb04d87e5563fbb6..2c704b055e220ebf291b22ad922eb38b1eb2a2f7 100644 --- a/src/test/java/de/thm/arsnova/services/StubUserService.java +++ b/src/test/java/de/thm/arsnova/services/StubUserService.java @@ -18,9 +18,8 @@ */ package de.thm.arsnova.services; -import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; - import de.thm.arsnova.entities.User; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; public class StubUserService extends UserService { diff --git a/src/test/java/de/thm/arsnova/services/UserServiceTest.java b/src/test/java/de/thm/arsnova/services/UserServiceTest.java index 229abb65d2c6cb614555c567330cbe311855248b..0dfab24575163c21d7b23b9b8a6487f86328cb52 100644 --- a/src/test/java/de/thm/arsnova/services/UserServiceTest.java +++ b/src/test/java/de/thm/arsnova/services/UserServiceTest.java @@ -1,6 +1,17 @@ package de.thm.arsnova.services; -import static org.junit.Assert.assertEquals; +import de.thm.arsnova.entities.User; +import org.jasig.cas.client.authentication.AttributePrincipalImpl; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.BlockJUnit4ClassRunner; +import org.scribe.up.profile.google.Google2AttributesDefinition; +import org.scribe.up.profile.google.Google2Profile; +import org.springframework.security.authentication.AnonymousAuthenticationToken; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.authority.SimpleGrantedAuthority; +import org.springframework.test.context.ActiveProfiles; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -14,19 +25,7 @@ import java.util.Map; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; -import org.jasig.cas.client.authentication.AttributePrincipalImpl; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.BlockJUnit4ClassRunner; -import org.scribe.up.profile.google.Google2AttributesDefinition; -import org.scribe.up.profile.google.Google2Profile; -import org.springframework.security.authentication.AnonymousAuthenticationToken; -import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; -import org.springframework.security.core.GrantedAuthority; -import org.springframework.security.core.authority.SimpleGrantedAuthority; -import org.springframework.test.context.ActiveProfiles; - -import de.thm.arsnova.entities.User; +import static org.junit.Assert.assertEquals; @RunWith(BlockJUnit4ClassRunner.class) @ActiveProfiles("test")