Skip to content

Commit

Permalink
Merge pull request #61 from TAMULib/sprint5-staging
Browse files Browse the repository at this point in the history
Sprint5 staging
  • Loading branch information
wwelling committed Aug 8, 2018
2 parents 566973a + 9610e69 commit 8501ffe
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 17 deletions.
8 changes: 5 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@
<artifactId>postgresql</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
Expand Down Expand Up @@ -101,7 +106,6 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.7</version>
<configuration>
<quiet>true</quiet>
<instrumentation>
Expand All @@ -120,7 +124,6 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.8</version>
<executions>
<execution>
<id>prepare-agent</id>
Expand All @@ -133,7 +136,6 @@
<plugin>
<groupId>org.eluder.coveralls</groupId>
<artifactId>coveralls-maven-plugin</artifactId>
<version>4.3.0</version>
<configuration>
<repoToken></repoToken>
</configuration>
Expand Down
21 changes: 21 additions & 0 deletions src/main/java/edu/tamu/app/config/AppH2ConsoleConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package edu.tamu.app.config;

import org.h2.server.web.WebServlet;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;

@Configuration
@Profile("!production")
public class AppH2ConsoleConfig {

@Bean
public ServletRegistrationBean h2servletRegistration() {
ServletRegistrationBean registrationBean = new ServletRegistrationBean(new WebServlet());
registrationBean.addUrlMappings("/admin/h2console/*");
registrationBean.addInitParameter("-webAllowOthers", "true");
return registrationBean;
}

}
10 changes: 0 additions & 10 deletions src/main/java/edu/tamu/app/config/AppWebMvcConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@

import java.util.List;

import org.h2.server.web.WebServlet;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
Expand Down Expand Up @@ -51,14 +49,6 @@ public ResourceUrlEncodingFilter resourceUrlEncodingFilter() {
return new ResourceUrlEncodingFilter();
}

@Bean
public ServletRegistrationBean h2servletRegistration() {
ServletRegistrationBean registrationBean = new ServletRegistrationBean(new WebServlet());
registrationBean.addUrlMappings("/admin/h2console/*");
registrationBean.addInitParameter("-webAllowOthers", "true");
return registrationBean;
}

@Bean
public ConfigurableMimeFileTypeMap configurableMimeFileTypeMap() {
return new ConfigurableMimeFileTypeMap();
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ security.basic.enabled: false

spring.template.cache: false

spring.profiles.active: production

spring.datasource.username: spring
spring.datasource.password: spring
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/edu/tamu/app/service/ProjectServiceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;

import com.fasterxml.jackson.core.JsonParseException;
Expand Down Expand Up @@ -86,7 +85,8 @@ public class ProjectServiceTest {
public void getAll() throws JsonParseException, JsonMappingException, MalformedURLException, IOException {
ApiResponse response = projectService.getAll();
assertEquals("Response was not a success!", ApiStatus.SUCCESS, response.getMeta().getStatus());
List<Project> projects = objectMapper.convertValue(response.getPayload().get("ArrayList<Project>"), new TypeReference<List<Project>>() {});
List<Project> projects = objectMapper.convertValue(response.getPayload().get("ArrayList<Project>"), new TypeReference<List<Project>>() {
});
List<Project> mockProjects = mockReader.getAllProjects();
assertEquals("Projects response size was not as expected!", mockProjects.size(), projects.size());
for (int i = 0; i < projects.size(); i++) {
Expand Down
3 changes: 1 addition & 2 deletions src/test/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ security.basic.enabled: false

spring.template.cache: false

spring.profiles: test
spring.profiles.active:test
spring.profiles.active: test

spring.datasource.username: spring
spring.datasource.password: spring
Expand Down

0 comments on commit 8501ffe

Please sign in to comment.