PAN-11 Stuck trying to get the integration tests to be configured correctly
This commit is contained in:
+2
@@ -5,6 +5,7 @@ import org.junit.Test;
|
|||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
|
import org.springframework.test.context.TestPropertySource;
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -17,6 +18,7 @@ import static org.mockito.AdditionalMatchers.not;
|
|||||||
|
|
||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
@ContextConfiguration(classes = ServiceTestConfig.class)
|
@ContextConfiguration(classes = ServiceTestConfig.class)
|
||||||
|
@TestPropertySource(locations = "classpath:test.properties")
|
||||||
public class DefinitionServiceIntegrationTest {
|
public class DefinitionServiceIntegrationTest {
|
||||||
@Autowired private DefinitionService definitionService;
|
@Autowired private DefinitionService definitionService;
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,16 @@
|
|||||||
package edu.msudenver.tsp.services;
|
package edu.msudenver.tsp.services;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.CommandLineRunner;
|
||||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.ComponentScan;
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.test.context.TestPropertySource;
|
import org.springframework.context.annotation.FilterType;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@ComponentScan
|
@ComponentScan(excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = CommandLineRunner.class))
|
||||||
@EnableAutoConfiguration(exclude = DataSourceAutoConfiguration.class)
|
@EnableAutoConfiguration
|
||||||
@TestPropertySource("classpath:test.properties")
|
|
||||||
public class ServiceTestConfig {
|
public class ServiceTestConfig {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import edu.msudenver.tsp.services.dto.Definition;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.annotation.PropertySource;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
@@ -15,7 +14,6 @@ import java.util.Optional;
|
|||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
@PropertySource(value = "classpath:application.properties", ignoreResourceNotFound = true)
|
|
||||||
public class DefinitionService {
|
public class DefinitionService {
|
||||||
private final RestService restService;
|
private final RestService restService;
|
||||||
@Value("${persistence.api.connection.timeout.milliseconds}") private int connectionTimeoutMilliseconds;
|
@Value("${persistence.api.connection.timeout.milliseconds}") private int connectionTimeoutMilliseconds;
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ import com.google.gson.annotations.SerializedName;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import javax.persistence.Temporal;
|
|
||||||
import javax.persistence.TemporalType;
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import javax.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
@@ -15,11 +13,12 @@ import java.util.Date;
|
|||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public class Account extends BaseDto implements Serializable {
|
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 = 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 password must be specified") @Size(max = 256) private String password;
|
||||||
@NotNull @SerializedName("administrator_status") private boolean administratorStatus;
|
@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;
|
private static final long serialVersionUID = 7095627971593953734L;
|
||||||
|
|
||||||
|
public interface Insert {}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user