Skip to content

Commit

Permalink
#706 rolled back to spring boot 1.3.8 due to validation error message
Browse files Browse the repository at this point in the history
issue
  • Loading branch information
René Reitmann committed Oct 18, 2016
1 parent 7b6c4f7 commit e3bcea7
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 54 deletions.
29 changes: 4 additions & 25 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>spring-boot-starter-parent</artifactId>
<groupId>org.springframework.boot</groupId>
<version>1.4.1.RELEASE</version>
<version>1.3.8.RELEASE</version>
<relativePath />
</parent>

Expand Down Expand Up @@ -40,7 +40,7 @@
<metrics-spring.version>3.1.3</metrics-spring.version>
<!-- Sonar properties -->
<project.testresult.directory>${project.build.directory}/test-results</project.testresult.directory>
<querydsl.version>4.1.4</querydsl.version>
<querydsl.version>3.7.4</querydsl.version>
<run.addResources>false</run.addResources>
<springfox.version>2.3.1</springfox.version>
</properties>
Expand Down Expand Up @@ -69,7 +69,7 @@
<!-- parent POM declares this dependency in default (compile) scope -->
</dependency>
<dependency>
<groupId>com.querydsl</groupId>
<groupId>com.mysema.querydsl</groupId>
<artifactId>querydsl-mongodb</artifactId>
<version>${querydsl.version}</version>
</dependency>
Expand Down Expand Up @@ -353,7 +353,7 @@
</executions>
<dependencies>
<dependency>
<groupId>com.querydsl</groupId>
<groupId>com.mysema.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
<version>${querydsl.version}</version>
</dependency>
Expand Down Expand Up @@ -568,13 +568,6 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>build-info</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>true</executable>
<jvmArguments>-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005</jvmArguments>
Expand Down Expand Up @@ -730,13 +723,6 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>build-info</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>true</executable>
<arguments>
Expand Down Expand Up @@ -847,13 +833,6 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>build-info</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>true</executable>
<arguments>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@

import java.lang.management.ManagementFactory;
import java.util.EnumSet;
import java.util.List;

import javax.inject.Inject;
import javax.servlet.DispatcherType;
import javax.servlet.FilterRegistration;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.ServletContextInitializer;
import org.springframework.boot.context.embedded.ServletContextInitializer;
import org.springframework.context.annotation.Configuration;

import com.codahale.metrics.MetricRegistry;
Expand All @@ -21,18 +19,16 @@
import com.codahale.metrics.jvm.MemoryUsageGaugeSet;
import com.codahale.metrics.jvm.ThreadStatesGaugeSet;
import com.codahale.metrics.servlet.InstrumentedFilter;
import com.ryantenney.metrics.spring.config.annotation.DelegatingMetricsConfiguration;
import com.ryantenney.metrics.spring.config.annotation.MetricsConfigurer;
import com.ryantenney.metrics.spring.config.annotation.EnableMetrics;

/**
* Attach spring-metrics and custom jvm metrics to spring boot actuator metrics endpoint.
*
* @author René Reitmann
* @author Daniel Katzberg
*/
@Configuration
public class MetricsConfiguration extends DelegatingMetricsConfiguration
implements ServletContextInitializer {
@EnableMetrics(proxyTargetClass = true)
public class MetricsConfiguration implements ServletContextInitializer {
private static final String PROP_METRIC_REG_JVM_MEMORY = "jvm.memory";
private static final String PROP_METRIC_REG_JVM_GARBAGE = "jvm.garbage";
private static final String PROP_METRIC_REG_JVM_THREADS = "jvm.threads";
Expand All @@ -41,12 +37,7 @@ public class MetricsConfiguration extends DelegatingMetricsConfiguration

@Inject
private MetricRegistry metricRegistry;

@Override
@Autowired(required = false)
public void setMetricsConfigurers(final List<MetricsConfigurer> configurers) {
}


@Override
public void onStartup(ServletContext servletContext) throws ServletException {
metricRegistry.register(PROP_METRIC_REG_JVM_MEMORY, new MemoryUsageGaugeSet());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer;
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
import org.springframework.boot.context.embedded.MimeMappings;
import org.springframework.boot.web.servlet.ServletContextInitializer;
import org.springframework.boot.context.embedded.ServletContextInitializer;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;

Expand Down
10 changes: 4 additions & 6 deletions src/test/java/eu/dzhw/fdz/metadatamanagement/AbstractTest.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package eu.dzhw.fdz.metadatamanagement;

import org.junit.runner.RunWith;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;

import eu.dzhw.fdz.metadatamanagement.common.config.Constants;
Expand All @@ -15,11 +14,10 @@
* @author Daniel Katzberg
*
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class)
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = Application.class)
@ActiveProfiles(Constants.SPRING_PROFILE_UNITTEST)
@WebAppConfiguration
@AutoConfigureMockMvc
public abstract class AbstractTest {

}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void testGetList() throws Exception {
MvcResult mvcResult =
this.restUserMockMvc.perform(get("/api/logs").accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andReturn();

String content = mvcResult.getResponse()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package eu.dzhw.fdz.metadatamanagement.studymanagement.rest;

import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.Matchers.is;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
Expand Down Expand Up @@ -90,7 +91,7 @@ public void testCreateStudyWithTooSurveySeries() throws IOException, Exception {
.content(TestUtil.convertObjectToJsonBytes(study)))
.andExpect(status().is4xxClientError());
}

@Test
public void testCreateStudyWithWrongId() throws IOException, Exception {
DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject();
Expand All @@ -102,7 +103,8 @@ public void testCreateStudyWithWrongId() throws IOException, Exception {
// create the study with the given id
mockMvc.perform(put(API_STUDY_URI + "/" + study.getId())
.content(TestUtil.convertObjectToJsonBytes(study)))
.andExpect(status().is4xxClientError());
.andExpect(status().is4xxClientError())
.andExpect(jsonPath("$.errors[0].message", containsString("study-management.error.study.id.not-equal-to-project-id")));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public void testGetExistingAccount() throws Exception {

restUserMockMvc.perform(get("/api/account").accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andExpect(jsonPath("$.login").value("test"))
.andExpect(jsonPath("$.firstName").value("john"))
.andExpect(jsonPath("$.lastName").value("Doe"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void testGetExistingUser() throws Exception {
// Assert
restUserMockMvc.perform(get("/api/users/admin").accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andExpect(jsonPath("$.lastName").value("Administrator"));
}

Expand Down Expand Up @@ -115,7 +115,7 @@ public void testGetAllUser() throws Exception {
// Act
MvcResult mvcResult = restUserMockMvc.perform(get("/api/users"))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andExpect(status().is2xxSuccessful())
.andReturn();
String content = mvcResult.getResponse()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,9 @@ public void testCreateVariableWithNonNumericValueOnContinouosScaleLevel() throws
// create the variable with duplicate value classes
mockMvc.perform(put(API_VARIABLES_URI + "/" + variable.getId())
.content(TestUtil.convertObjectToJsonBytes(variable)))
.andExpect(status().is4xxClientError())
.andReturn();
.andExpect(status().isBadRequest())
.andExpect(jsonPath("$.errors[0].message", containsString("variable-management.error.variable.valid-response-value-must-be-a-number-on-numeric-data-type")));

}

@Test
Expand Down

0 comments on commit e3bcea7

Please sign in to comment.