PAN-11 Stuck trying to get the integration tests to be configured correctly

This commit is contained in:
2019-03-17 22:02:00 -06:00
parent 3853911b3c
commit b48094ba26
4 changed files with 10 additions and 12 deletions
@@ -5,6 +5,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringRunner;
import java.util.ArrayList;
@@ -17,6 +18,7 @@ import static org.mockito.AdditionalMatchers.not;
@RunWith(SpringRunner.class)
@ContextConfiguration(classes = ServiceTestConfig.class)
@TestPropertySource(locations = "classpath:test.properties")
public class DefinitionServiceIntegrationTest {
@Autowired private DefinitionService definitionService;
@@ -1,17 +1,16 @@
package edu.msudenver.tsp.services;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.test.context.TestPropertySource;
import org.springframework.context.annotation.FilterType;
@Configuration
@ComponentScan
@EnableAutoConfiguration(exclude = DataSourceAutoConfiguration.class)
@TestPropertySource("classpath:test.properties")
@ComponentScan(excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = CommandLineRunner.class))
@EnableAutoConfiguration
public class ServiceTestConfig {
@Bean
@@ -6,7 +6,6 @@ import edu.msudenver.tsp.services.dto.Definition;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Service;
import java.time.Duration;
@@ -15,7 +14,6 @@ import java.util.Optional;
@Slf4j
@Service
@PropertySource(value = "classpath:application.properties", ignoreResourceNotFound = true)
public class DefinitionService {
private final RestService restService;
@Value("${persistence.api.connection.timeout.milliseconds}") private int connectionTimeoutMilliseconds;
@@ -4,8 +4,6 @@ import com.google.gson.annotations.SerializedName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
@@ -15,11 +13,12 @@ import java.util.Date;
@Data
@EqualsAndHashCode(callSuper = true)
public class Account extends BaseDto implements Serializable {
@NotBlank(groups = edu.msudenver.tsp.persistence.dto.Account.Insert.class, message = "A username must be specified") @Size(max = 50) private String username;
@NotBlank(groups = edu.msudenver.tsp.persistence.dto.Account.Insert.class, message = "A password must be specified") @Size(max = 256) private String password;
@NotBlank(groups = Insert.class, message = "A username must be specified") @Size(max = 50) private String username;
@NotBlank(groups = Insert.class, message = "A password must be specified") @Size(max = 256) private String password;
@NotNull @SerializedName("administrator_status") private boolean administratorStatus;
@Temporal(TemporalType.DATE) @SerializedName("last_login") private Date lastLogin;
@SerializedName("last_login") private Date lastLogin;
private static final long serialVersionUID = 7095627971593953734L;
public interface Insert {}
}