Commit b42ba8a9 authored by Colin DAMON's avatar Colin DAMON

Ignore coverage for generated classes

parent 6be18b3d
......@@ -497,6 +497,11 @@
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco-maven-plugin.version}</version>
<configuration>
<excludes>
<exclude>com/ippon/pouet/domain/*</exclude>
</excludes>
</configuration>
<executions>
<execution>
<id>pre-unit-tests</id>
......
......@@ -5,10 +5,13 @@ import io.github.jhipster.config.DefaultProfileUtil;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import com.ippon.pouet.common.domain.Generated;
/**
* This is a helper Java class that provides an alternative to creating a {@code web.xml}.
* This will be invoked only when the application is deployed to a Servlet container like Tomcat, JBoss etc.
*/
@Generated
public class ApplicationWebXml extends SpringBootServletInitializer {
@Override
......
package com.ippon.pouet;
import com.ippon.pouet.common.domain.Generated;
import com.ippon.pouet.config.ApplicationProperties;
import io.github.jhipster.config.DefaultProfileUtil;
......@@ -20,6 +21,7 @@ import java.net.UnknownHostException;
import java.util.Arrays;
import java.util.Collection;
@Generated
@SpringBootApplication
@EnableConfigurationProperties({LiquibaseProperties.class, ApplicationProperties.class})
public class PouetApp {
......
......@@ -13,6 +13,8 @@ import org.slf4j.LoggerFactory;
import org.springframework.core.env.Environment;
import org.springframework.core.env.Profiles;
import com.ippon.pouet.common.domain.Generated;
import java.util.Arrays;
/**
......@@ -21,6 +23,7 @@ import java.util.Arrays;
* By default, it only runs with the "dev" profile.
*/
@Aspect
@Generated
public class LoggingAspect {
private final Environment env;
......
package com.ippon.pouet.common.domain;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.METHOD, ElementType.TYPE, ElementType.CONSTRUCTOR })
public @interface Generated {
}
......@@ -2,12 +2,15 @@ package com.ippon.pouet.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import com.ippon.pouet.common.domain.Generated;
/**
* Properties specific to Pouet.
* <p>
* Properties are configured in the {@code application.yml} file.
* See {@link io.github.jhipster.config.JHipsterProperties} for a good example.
*/
@Generated
@ConfigurationProperties(prefix = "application", ignoreUnknownFields = false)
public class ApplicationProperties {
}
......@@ -13,10 +13,13 @@ import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import com.ippon.pouet.common.domain.Generated;
import java.util.concurrent.Executor;
@Configuration
@Generated
@EnableAsync
@Configuration
@EnableScheduling
public class AsyncConfiguration implements AsyncConfigurer {
......
......@@ -7,10 +7,12 @@ import org.slf4j.LoggerFactory;
import org.springframework.cloud.config.java.AbstractCloudConfig;
import org.springframework.context.annotation.*;
import com.ippon.pouet.common.domain.Generated;
import javax.sql.DataSource;
import org.springframework.boot.context.properties.ConfigurationProperties;
@Generated
@Configuration
@Profile(JHipsterConstants.SPRING_PROFILE_CLOUD)
public class CloudDatabaseConfiguration extends AbstractCloudConfig {
......
package com.ippon.pouet.config;
import com.ippon.pouet.common.domain.Generated;
/**
* Application constants.
*/
@Generated
public final class Constants {
// Regex for acceptable logins
......
......@@ -13,8 +13,11 @@ import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import com.ippon.pouet.common.domain.Generated;
import java.sql.SQLException;
@Generated
@Configuration
@EnableJpaRepositories("com.ippon.pouet.repository")
@EnableJpaAuditing(auditorAwareRef = "springSecurityAuditorAware")
......
......@@ -5,9 +5,12 @@ import org.springframework.format.FormatterRegistry;
import org.springframework.format.datetime.standard.DateTimeFormatterRegistrar;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import com.ippon.pouet.common.domain.Generated;
/**
* Configure the converters to use the ISO format for dates by default.
*/
@Generated
@Configuration
public class DateTimeFormatConfiguration implements WebMvcConfigurer {
......
......@@ -3,12 +3,14 @@ package com.ippon.pouet.config;
import com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module;
import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.ippon.pouet.common.domain.Generated;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.zalando.problem.ProblemModule;
import org.zalando.problem.violations.ConstraintViolationProblemModule;
@Generated
@Configuration
public class JacksonConfiguration {
......
......@@ -15,9 +15,12 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.core.env.Profiles;
import com.ippon.pouet.common.domain.Generated;
import javax.sql.DataSource;
import java.util.concurrent.Executor;
@Generated
@Configuration
public class LiquibaseConfiguration {
......
......@@ -8,6 +8,9 @@ import org.springframework.web.servlet.LocaleResolver;
import org.springframework.web.servlet.config.annotation.*;
import org.springframework.web.servlet.i18n.LocaleChangeInterceptor;
import com.ippon.pouet.common.domain.Generated;
@Generated
@Configuration
public class LocaleConfiguration implements WebMvcConfigurer {
......
package com.ippon.pouet.config;
import com.ippon.pouet.aop.logging.LoggingAspect;
import com.ippon.pouet.common.domain.Generated;
import io.github.jhipster.config.JHipsterConstants;
import org.springframework.context.annotation.*;
import org.springframework.core.env.Environment;
@Generated
@Configuration
@EnableAspectJAutoProxy
public class LoggingAspectConfiguration {
......
......@@ -3,6 +3,8 @@ package com.ippon.pouet.config;
import ch.qos.logback.classic.LoggerContext;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.ippon.pouet.common.domain.Generated;
import io.github.jhipster.config.JHipsterProperties;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
......@@ -16,6 +18,7 @@ import static io.github.jhipster.config.logging.LoggingUtils.*;
/*
* Configures the console and Logstash log appenders from the app properties
*/
@Generated
@Configuration
public class LoggingConfiguration {
......
package com.ippon.pouet.config;
import com.ippon.pouet.common.domain.Generated;
import com.ippon.pouet.security.*;
import com.ippon.pouet.security.jwt.*;
......@@ -19,6 +20,7 @@ import org.springframework.security.web.header.writers.ReferrerPolicyHeaderWrite
import org.springframework.web.filter.CorsFilter;
import org.zalando.problem.spring.web.advice.security.SecurityProblemSupport;
@Generated
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true)
@Import(SecurityProblemSupport.class)
......
......@@ -9,8 +9,11 @@ import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistra
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import com.ippon.pouet.common.domain.Generated;
import java.util.concurrent.TimeUnit;
@Generated
@Configuration
@Profile({JHipsterConstants.SPRING_PROFILE_PRODUCTION})
public class StaticResourcesWebConfiguration implements WebMvcConfigurer {
......
......@@ -17,6 +17,8 @@ import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;
import com.ippon.pouet.common.domain.Generated;
import javax.servlet.*;
import java.io.File;
import java.io.UnsupportedEncodingException;
......@@ -28,6 +30,7 @@ import static java.net.URLDecoder.decode;
/**
* Configuration of web application with Servlet 3.0 APIs.
*/
@Generated
@Configuration
public class WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> {
......
package com.ippon.pouet.config.audit;
import com.ippon.pouet.common.domain.Generated;
import com.ippon.pouet.domain.PersistentAuditEvent;
import org.springframework.boot.actuate.audit.AuditEvent;
......@@ -8,6 +9,7 @@ import org.springframework.stereotype.Component;
import java.util.*;
@Generated
@Component
public class AuditEventConverter {
......
package com.ippon.pouet.domain;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.ippon.pouet.common.domain.Generated;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
......@@ -17,6 +19,7 @@ import javax.persistence.MappedSuperclass;
* Base abstract class for entities which will hold definitions for created, last modified, created by,
* last modified by attributes.
*/
@Generated
@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
public abstract class AbstractAuditingEntity implements Serializable {
......
......@@ -6,6 +6,9 @@ import javax.persistence.Table;
import javax.persistence.Column;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import com.ippon.pouet.common.domain.Generated;
import java.io.Serializable;
import java.util.Objects;
......@@ -13,6 +16,7 @@ import java.util.Objects;
* An authority (a security role) used by Spring Security.
*/
@Entity
@Generated
@Table(name = "jhi_authority")
public class Authority implements Serializable {
......
package com.ippon.pouet.domain;
import com.ippon.pouet.common.domain.Generated;
import com.ippon.pouet.config.Constants;
import com.fasterxml.jackson.annotation.JsonIgnore;
......@@ -21,6 +22,7 @@ import java.util.Set;
* A user.
*/
@Entity
@Generated
@Table(name = "jhi_user")
public class User extends AbstractAuditingEntity implements Serializable {
......
package com.ippon.pouet.repository;
import com.ippon.pouet.common.domain.Generated;
import com.ippon.pouet.config.Constants;
import com.ippon.pouet.config.audit.AuditEventConverter;
import com.ippon.pouet.domain.PersistentAuditEvent;
......@@ -18,6 +19,7 @@ import java.util.*;
/**
* An implementation of Spring Boot's {@link AuditEventRepository}.
*/
@Generated
@Repository
public class CustomAuditEventRepository implements AuditEventRepository {
......
package com.ippon.pouet.security;
import com.ippon.pouet.common.domain.Generated;
/**
* Constants for Spring Security authorities.
*/
@Generated
public final class AuthoritiesConstants {
public static final String ADMIN = "ROLE_ADMIN";
......
package com.ippon.pouet.security;
import com.ippon.pouet.common.domain.Generated;
import com.ippon.pouet.domain.User;
import com.ippon.pouet.repository.UserRepository;
import org.hibernate.validator.internal.constraintvalidators.hv.EmailValidator;
......@@ -19,6 +20,7 @@ import java.util.stream.Collectors;
/**
* Authenticate a user from the database.
*/
@Generated
@Component("userDetailsService")
public class DomainUserDetailsService implements UserDetailsService {
......
......@@ -6,12 +6,15 @@ import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
import com.ippon.pouet.common.domain.Generated;
import java.util.Optional;
import java.util.stream.Stream;
/**
* Utility class for Spring Security.
*/
@Generated
public final class SecurityUtils {
private SecurityUtils() {
......
package com.ippon.pouet.security;
import com.ippon.pouet.common.domain.Generated;
import com.ippon.pouet.config.Constants;
import java.util.Optional;
......@@ -11,6 +12,7 @@ import org.springframework.stereotype.Component;
* Implementation of {@link AuditorAware} based on Spring Security.
*/
@Component
@Generated
public class SpringSecurityAuditorAware implements AuditorAware<String> {
@Override
......
......@@ -2,9 +2,12 @@ package com.ippon.pouet.security;
import org.springframework.security.core.AuthenticationException;
import com.ippon.pouet.common.domain.Generated;
/**
* This exception is thrown in case of a not activated user trying to authenticate.
*/
@Generated
public class UserNotActivatedException extends AuthenticationException {
private static final long serialVersionUID = 1L;
......
......@@ -5,6 +5,9 @@ import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.web.DefaultSecurityFilterChain;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import com.ippon.pouet.common.domain.Generated;
@Generated
public class JWTConfigurer extends SecurityConfigurerAdapter<DefaultSecurityFilterChain, HttpSecurity> {
private final TokenProvider tokenProvider;
......
......@@ -5,6 +5,8 @@ import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.util.StringUtils;
import org.springframework.web.filter.GenericFilterBean;
import com.ippon.pouet.common.domain.Generated;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
......@@ -16,6 +18,7 @@ import java.io.IOException;
* Filters incoming requests and installs a Spring Security principal if a header corresponding to a valid user is
* found.
*/
@Generated
public class JWTFilter extends GenericFilterBean {
public static final String AUTHORIZATION_HEADER = "Authorization";
......
......@@ -16,12 +16,15 @@ import org.springframework.security.core.userdetails.User;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import com.ippon.pouet.common.domain.Generated;
import io.github.jhipster.config.JHipsterProperties;
import io.jsonwebtoken.*;
import io.jsonwebtoken.io.Decoders;
import io.jsonwebtoken.security.Keys;
@Component
@Generated
public class TokenProvider {
private final Logger log = LoggerFactory.getLogger(TokenProvider.class);
......
package com.ippon.pouet.service;
import io.github.jhipster.config.JHipsterProperties;
import com.ippon.pouet.common.domain.Generated;
import com.ippon.pouet.config.audit.AuditEventConverter;
import com.ippon.pouet.repository.PersistenceAuditEventRepository;
import org.slf4j.Logger;
......@@ -22,6 +24,7 @@ import java.util.Optional;
* This is the default implementation to support SpringBoot Actuator {@code AuditEventRepository}.
*/
@Service
@Generated
@Transactional
public class AuditEventService {
......
package com.ippon.pouet.service;
import com.ippon.pouet.common.domain.Generated;
@Generated
public class EmailAlreadyUsedException extends RuntimeException {
private static final long serialVersionUID = 1L;
......
package com.ippon.pouet.service;
import com.ippon.pouet.common.domain.Generated;
@Generated
public class InvalidPasswordException extends RuntimeException {
private static final long serialVersionUID = 1L;
......
package com.ippon.pouet.service;
import com.ippon.pouet.common.domain.Generated;
import com.ippon.pouet.domain.User;
import io.github.jhipster.config.JHipsterProperties;
......@@ -26,6 +27,7 @@ import org.thymeleaf.spring5.SpringTemplateEngine;
* We use the {@link Async} annotation to send emails asynchronously.
*/
@Service
@Generated
public class MailService {
private final Logger log = LoggerFactory.getLogger(MailService.class);
......
package com.ippon.pouet.service;
import com.ippon.pouet.common.domain.Generated;
import com.ippon.pouet.config.Constants;
import com.ippon.pouet.domain.Authority;
import com.ippon.pouet.domain.User;
......@@ -29,6 +30,7 @@ import java.util.stream.Collectors;
* Service class for managing users.
*/
@Service
@Generated
@Transactional
public class UserService {
......
package com.ippon.pouet.service;
import com.ippon.pouet.common.domain.Generated;
@Generated
public class UsernameAlreadyUsedException extends RuntimeException {
private static final long serialVersionUID = 1L;
......
package com.ippon.pouet.service.dto;
import com.ippon.pouet.common.domain.Generated;
/**
* A DTO representing a password change required data - current and new password.
*/
@Generated
public class PasswordChangeDTO {
private String currentPassword;
private String newPassword;
......
package com.ippon.pouet.service.dto;
import com.ippon.pouet.common.domain.Generated;
import com.ippon.pouet.config.Constants;
import com.ippon.pouet.domain.Authority;
......@@ -13,6 +14,7 @@ import java.util.stream.Collectors;
/**
* A DTO representing a user, with his authorities.
*/
@Generated
public class UserDTO {
private Long id;
......
package com.ippon.pouet.service.mapper;
import com.ippon.pouet.common.domain.Generated;
import com.ippon.pouet.domain.Authority;
import com.ippon.pouet.domain.User;
import com.ippon.pouet.service.dto.UserDTO;
......@@ -16,6 +17,7 @@ import java.util.stream.Collectors;
* support is still in beta, and requires a manual step with an IDE.
*/
@Service
@Generated
public class UserMapper {
public List<UserDTO> usersToUserDTOs(List<User> users) {
......
package com.ippon.pouet.web.rest;
import com.ippon.pouet.common.domain.Generated;
import com.ippon.pouet.domain.User;
import com.ippon.pouet.repository.UserRepository;
import com.ippon.pouet.security.SecurityUtils;
......@@ -24,164 +25,194 @@ import java.util.*;
/**
* REST controller for managing the current user's account.
*/
@Generated
@RestController
@RequestMapping("/api")
public class AccountResource {
private static class AccountResourceException extends RuntimeException {
private AccountResourceException(String message) {
super(message);
}
@Generated
private static class AccountResourceException extends RuntimeException {
private AccountResourceException(String message) {
super(message);
}
private final Logger log = LoggerFactory.getLogger(AccountResource.class);
private final UserRepository userRepository;
private final UserService userService;
private final MailService mailService;
public AccountRe