Skip to content

Commit 8501ffe

Browse files
authored
Merge pull request #61 from TAMULib/sprint5-staging
Sprint5 staging
2 parents 566973a + 9610e69 commit 8501ffe

6 files changed

Lines changed: 30 additions & 17 deletions

File tree

pom.xml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@
6262
<artifactId>postgresql</artifactId>
6363
</dependency>
6464

65+
<dependency>
66+
<groupId>org.springframework.boot</groupId>
67+
<artifactId>spring-boot-starter-actuator</artifactId>
68+
</dependency>
69+
6570
<dependency>
6671
<groupId>org.springframework</groupId>
6772
<artifactId>spring-test</artifactId>
@@ -101,7 +106,6 @@
101106
<plugin>
102107
<groupId>org.codehaus.mojo</groupId>
103108
<artifactId>cobertura-maven-plugin</artifactId>
104-
<version>2.7</version>
105109
<configuration>
106110
<quiet>true</quiet>
107111
<instrumentation>
@@ -120,7 +124,6 @@
120124
<plugin>
121125
<groupId>org.jacoco</groupId>
122126
<artifactId>jacoco-maven-plugin</artifactId>
123-
<version>0.7.8</version>
124127
<executions>
125128
<execution>
126129
<id>prepare-agent</id>
@@ -133,7 +136,6 @@
133136
<plugin>
134137
<groupId>org.eluder.coveralls</groupId>
135138
<artifactId>coveralls-maven-plugin</artifactId>
136-
<version>4.3.0</version>
137139
<configuration>
138140
<repoToken></repoToken>
139141
</configuration>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package edu.tamu.app.config;
2+
3+
import org.h2.server.web.WebServlet;
4+
import org.springframework.boot.web.servlet.ServletRegistrationBean;
5+
import org.springframework.context.annotation.Bean;
6+
import org.springframework.context.annotation.Configuration;
7+
import org.springframework.context.annotation.Profile;
8+
9+
@Configuration
10+
@Profile("!production")
11+
public class AppH2ConsoleConfig {
12+
13+
@Bean
14+
public ServletRegistrationBean h2servletRegistration() {
15+
ServletRegistrationBean registrationBean = new ServletRegistrationBean(new WebServlet());
16+
registrationBean.addUrlMappings("/admin/h2console/*");
17+
registrationBean.addInitParameter("-webAllowOthers", "true");
18+
return registrationBean;
19+
}
20+
21+
}

src/main/java/edu/tamu/app/config/AppWebMvcConfig.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22

33
import java.util.List;
44

5-
import org.h2.server.web.WebServlet;
65
import org.springframework.beans.factory.annotation.Autowired;
76
import org.springframework.beans.factory.annotation.Value;
87
import org.springframework.boot.autoconfigure.domain.EntityScan;
98
import org.springframework.boot.web.client.RestTemplateBuilder;
10-
import org.springframework.boot.web.servlet.ServletRegistrationBean;
119
import org.springframework.context.annotation.Bean;
1210
import org.springframework.context.annotation.Configuration;
1311
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
@@ -51,14 +49,6 @@ public ResourceUrlEncodingFilter resourceUrlEncodingFilter() {
5149
return new ResourceUrlEncodingFilter();
5250
}
5351

54-
@Bean
55-
public ServletRegistrationBean h2servletRegistration() {
56-
ServletRegistrationBean registrationBean = new ServletRegistrationBean(new WebServlet());
57-
registrationBean.addUrlMappings("/admin/h2console/*");
58-
registrationBean.addInitParameter("-webAllowOthers", "true");
59-
return registrationBean;
60-
}
61-
6252
@Bean
6353
public ConfigurableMimeFileTypeMap configurableMimeFileTypeMap() {
6454
return new ConfigurableMimeFileTypeMap();

src/main/resources/application.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ security.basic.enabled: false
66

77
spring.template.cache: false
88

9+
spring.profiles.active: production
910

1011
spring.datasource.username: spring
1112
spring.datasource.password: spring

src/test/java/edu/tamu/app/service/ProjectServiceTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import org.springframework.beans.factory.annotation.Autowired;
1414
import org.springframework.boot.test.context.SpringBootTest;
1515
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
16-
import org.springframework.test.context.ActiveProfiles;
1716
import org.springframework.test.context.junit4.SpringRunner;
1817

1918
import com.fasterxml.jackson.core.JsonParseException;
@@ -86,7 +85,8 @@ public class ProjectServiceTest {
8685
public void getAll() throws JsonParseException, JsonMappingException, MalformedURLException, IOException {
8786
ApiResponse response = projectService.getAll();
8887
assertEquals("Response was not a success!", ApiStatus.SUCCESS, response.getMeta().getStatus());
89-
List<Project> projects = objectMapper.convertValue(response.getPayload().get("ArrayList<Project>"), new TypeReference<List<Project>>() {});
88+
List<Project> projects = objectMapper.convertValue(response.getPayload().get("ArrayList<Project>"), new TypeReference<List<Project>>() {
89+
});
9090
List<Project> mockProjects = mockReader.getAllProjects();
9191
assertEquals("Projects response size was not as expected!", mockProjects.size(), projects.size());
9292
for (int i = 0; i < projects.size(); i++) {

src/test/resources/application.properties

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ security.basic.enabled: false
66

77
spring.template.cache: false
88

9-
spring.profiles: test
10-
spring.profiles.active:test
9+
spring.profiles.active: test
1110

1211
spring.datasource.username: spring
1312
spring.datasource.password: spring

0 commit comments

Comments
 (0)