synchronize from latest generator, with Travis update

This commit is contained in:
Julien Dubois 2016-10-06 16:10:41 +02:00
parent df5b9b5a62
commit a47315f560
24 changed files with 213 additions and 111 deletions

5
.gitignore vendored
View File

@ -55,6 +55,11 @@ local.properties
*.ids
*.orig
######################
# Visual Studio Code
######################
.vscode/**
######################
# Maven
######################

View File

@ -1,4 +1,10 @@
os:
- linux
services:
- docker
language: java
node_js:
- "4.5.0"
jdk:
- oraclejdk8
sudo: false
@ -8,7 +14,7 @@ cache:
- node_modules
- $HOME/.m2
env:
- NODE_VERSION=4.4.7
- NODE_VERSION=4.5.0
before_install:
- nvm install $NODE_VERSION
- npm install -g npm

View File

@ -28,6 +28,7 @@
"enableSocialSignIn": false,
"useSass": false,
"jhiPrefix": "jhi",
"messageBroker": false
"messageBroker": false,
"serviceDiscoveryType": false
}
}

View File

@ -1,11 +1,10 @@
# jhipsterSampleApplication
This application was generated using JHipster, you can find documentation and help at [https://jhipster.github.io](https://jhipster.github.io).
This application was generated using JHipster 3.8.0, you can find documentation and help at [https://jhipster.github.io/documentation-archive/v3.8.0](https://jhipster.github.io/documentation-archive/v3.8.0).
## Development
Before you can build this project, you must install and configure the following dependencies on your machine:
1. [Node.js][]: We use Node to run a development web server and build the project.
Depending on your system, you can install Node either from source or as a pre-packaged bundle.
@ -16,7 +15,7 @@ After installing Node, you should be able to run the following command to instal
We use [Gulp][] as our build system. Install the Gulp command-line tool globally with:
npm install -g gulp
npm install -g gulp-cli
Run the following commands in two separate terminals to create a blissful development experience where your browser
auto-refreshes when files change on your hard drive.
@ -28,61 +27,80 @@ Bower is used to manage CSS and JavaScript dependencies used in this application
specifying a newer version in `bower.json`. You can also run `bower update` and `bower install` to manage dependencies.
Add the `-h` flag on any command to see how you can use it. For example, `bower update -h`.
For further instructions on how to develop with JHipster, have a look at [Using JHipster in development][].
## Building for production
To optimize the jhipsterSampleApplication client for production, run:
To optimize the jhipsterSampleApplication application for production, run:
./mvnw -Pprod clean package
This will concatenate and minify CSS and JavaScript files. It will also modify `index.html` so it references
these new files.
This will concatenate and minify the client CSS and JavaScript files. It will also modify `index.html` so it references these new files.
To ensure everything worked, run:
java -jar target/*.war
Then navigate to [http://localhost:8080](http://localhost:8080) in your browser.
Refer to [Using JHipster in production][] for more details.
## Testing
To launch your application's tests, run:
./mvnw clean test
### Client tests
Unit tests are run by [Karma][] and written with [Jasmine][]. They're located in `src/test/javascript/` and can be run with:
gulp test
UI end-to-end tests are powered by [Protractor][], which is built on top of WebDriverJS. They're located in `src/test/javascript/e2e`
and can be run by starting Spring Boot in one terminal (`./mvnw spring-boot:run`) and running the tests (`gulp itest`) in a second one.
### Other tests
Performance tests are run by [Gatling]() and written in Scala. They're located in `src/test/gatling` and can be run with:
Performance tests are run by [Gatling][] and written in Scala. They're located in `src/test/gatling` and can be run with:
./mvnw gatling:execute
## Continuous Integration
For more information, refer to the [Running tests page][].
To setup this project in Jenkins, use the following configuration:
## Using Docker to simplify development (optional)
* Project name: `jhipsterSampleApplication`
* Source Code Management
* Git Repository: `git@github.com:xxxx/jhipsterSampleApplication.git`
* Branches to build: `*/master`
* Additional Behaviours: `Wipe out repository & force clone`
* Build Triggers
* Poll SCM / Schedule: `H/5 * * * *`
* Build
* Invoke Maven / Tasks: `-Pprod clean package`
* Execute Shell / Command:
````
./mvnw spring-boot:run &
bootPid=$!
sleep 30s
gulp itest
kill $bootPid
````
* Post-build Actions
* Publish JUnit test result report / Test Report XMLs: `build/test-results/*.xml,build/reports/e2e/*.xml`
You can use Docker to improve your JHipster development experience. A number of docker-compose configuration are available in the `src/main/docker` folder to launch required third party services.
For example, to start a mysql database in a docker container, run:
docker-compose -f src/main/docker/mysql.yml up -d
To stop it and remove the container, run:
docker-compose -f src/main/docker/mysql.yml down
You can also fully dockerize your application and all the services that it depends on.
To achieve this, first build a docker image of your app by running:
./mvnw package -Pprod docker:build
Then run:
docker-compose -f src/main/docker/app.yml up -d
For more information refer to [Using Docker and Docker-Compose][], this page also contains information on the docker-compose sub-generator (`yo jhipster:docker-compose`), which is able to generate docker configurations for one or several JHipster applications.
## Continuous Integration (optional)
To set up a CI environment, consult the [Setting up Continuous Integration][] page.
[JHipster Homepage and latest documentation]: https://jhipster.github.io
[JHipster 3.8.0 archive]: https://jhipster.github.io/documentation-archive/v3.8.0
[Using JHipster in development]: https://jhipster.github.io/documentation-archive/v3.8.0/development/
[Using Docker and Docker-Compose]: https://jhipster.github.io/documentation-archive/v3.8.0/docker-compose
[Using JHipster in production]: https://jhipster.github.io/documentation-archive/v3.8.0/production/
[Running tests page]: https://jhipster.github.io/documentation-archive/v3.8.0/running-tests/
[Setting up Continuous Integration]: https://jhipster.github.io/documentation-archive/v3.8.0/setting-up-ci/
[JHipster]: https://jhipster.github.io/
[Gatling]: http://gatling.io/
[Node.js]: https://nodejs.org/
[Bower]: http://bower.io/

View File

@ -15,7 +15,10 @@ module.exports = function () {
// redirect. This is required for some endpoints for proxy-middleware
// to correctly handle them.
var proxyRoutes = [
'/'
'/api',
'/management',
'/swagger-resources',
'/h2-console'
];
var requireTrailingSlash = proxyRoutes.filter(function (r) {

View File

@ -1,4 +1,4 @@
// Generated on 2016-09-22 using generator-jhipster 3.8.0
// Generated on 2016-10-06 using generator-jhipster 3.8.0
'use strict';
var gulp = require('gulp'),

View File

@ -9,7 +9,7 @@
],
"devDependencies": {
"bower": "1.7.9",
"browser-sync": "2.15.0",
"browser-sync": "2.17.0",
"del": "2.2.2",
"eslint-config-angular": "0.5.0",
"eslint-plugin-angular": "1.3.1",

111
pom.xml
View File

@ -20,7 +20,7 @@
</prerequisites>
<properties>
<hikaricp.version>2.4.6</hikaricp.version>
<argLine>-Djava.security.egd=file:/dev/./urandom -Xmx256m</argLine>
<assertj-core.version>3.5.2</assertj-core.version>
<awaitility.version>1.7.0</awaitility.version>
<commons-io.version>2.5</commons-io.version>
@ -29,6 +29,7 @@
<gatling.version>2.1.7</gatling.version>
<gatling-maven-plugin.version>2.1.7</gatling-maven-plugin.version>
<hibernate.version>4.3.11.Final</hibernate.version>
<hikaricp.version>2.4.6</hikaricp.version>
<java.version>1.8</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
@ -49,7 +50,7 @@
<springfox.version>2.5.0</springfox.version>
<!-- Sonar properties -->
<project.testresult.directory>${project.build.directory}/test-results</project.testresult.directory>
<sonar-maven-plugin.version>3.0.2</sonar-maven-plugin.version>
<sonar-maven-plugin.version>3.2</sonar-maven-plugin.version>
<jacoco-maven-plugin.version>0.7.7.201606060606</jacoco-maven-plugin.version>
<sonar.exclusions>src/main/webapp/content/**/*.*, src/main/webapp/bower_components/**/*.*, target/www/**/*.*</sonar.exclusions>
<sonar.java.codeCoveragePlugin>jacoco</sonar.java.codeCoveragePlugin>
@ -196,13 +197,6 @@
</exclusion>
</exclusions>
</dependency>
<!-- The HikariCP Java Agent is disabled by default, as it is experimental
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP-agent</artifactId>
<version>${HikariCP.version}</version>
</dependency>
-->
<dependency>
<groupId>commons-io</groupId>
@ -499,7 +493,6 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>-Djava.security.egd=file:/dev/./urandom -Xmx256m ${surefireArgLine}</argLine>
<!-- Force alphabetical order to have a reproducible build -->
<runOrder>alphabetical</runOrder>
</configuration>
@ -517,8 +510,6 @@
<configuration>
<!-- Sets the path to the file which contains the execution data. -->
<destFile>${project.testresult.directory}/coverage/jacoco/jacoco.exec</destFile>
<!-- Sets the name of the property containing the settings for JaCoCo runtime agent. -->
<propertyName>surefireArgLine</propertyName>
</configuration>
</execution>
<!-- Ensures that the code coverage report for unit tests is created after unit tests have been run -->
@ -695,7 +686,6 @@
</plugins>
</pluginManagement>
</build>
<profiles>
<profile>
<id>no-liquibase</id>
@ -857,5 +847,100 @@
<spring.profiles.active>prod${profile.swagger}${profile.no-liquibase}</spring.profiles.active>
</properties>
</profile>
<profile>
<!--
Profile for doing "continuous compilation" with the Scala Maven plugin.
It allows automatic compilation of Java classes as soon as they are saved.
To use it, run in 3 terminals:
- './mvnw -Pcc scala:cc' for continous compilation of your classes
- './mvnw -Pcc' for hot reload of Spring boot
- 'gulp' for hot reload of the HTML/JavaScript assets
Everything should hot reload automatically!
-->
<id>cc</id>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-undertow</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<warSourceDirectory>src/main/webapp/</warSourceDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<executable>true</executable>
<fork>true</fork>
<addResources>true</addResources>
<!--
Enable the line below to have remote debugging of your application on port 5005
<jvmArguments>-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005</jvmArguments>
-->
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<id>default-compile</id>
<phase>none</phase>
</execution>
<execution>
<id>default-testCompile</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>3.2.2</version>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>add-source</goal>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>test-compile</id>
<phase>test-compile</phase>
<goals>
<goal>add-source</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
<configuration>
<recompileMode>incremental</recompileMode>
<verbose>true</verbose>
<scalaVersion>2.11.7</scalaVersion>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<!-- log configuration -->
<logback.loglevel>DEBUG</logback.loglevel>
<!-- default Spring profiles -->
<spring.profiles.active>dev,swagger</spring.profiles.active>
</properties>
</profile>
</profiles>
</project>

View File

@ -2,7 +2,7 @@ version: '2'
services:
jhipstersampleapplication-sonar:
container_name: jhipstersampleapplication-sonar
image: sonarqube:5.6.1-alpine
image: sonarqube:5.6.2-alpine
ports:
- 9000:9000
- 9092:9092

View File

@ -14,6 +14,9 @@ public final class DefaultProfileUtil {
private static final String SPRING_PROFILE_DEFAULT = "spring.profiles.default";
private DefaultProfileUtil(){
}
/**
* Set a default to use when no profile is configured.
*

View File

@ -1,22 +0,0 @@
package io.github.jhipster.sample.config;
import com.fasterxml.jackson.datatype.jsr310.ser.ZonedDateTimeSerializer;
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
@Configuration
public class JacksonConfiguration {
public static final DateTimeFormatter ISO_FIXED_FORMAT =
DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").withZone(ZoneId.of("Z"));
@Bean
public Jackson2ObjectMapperBuilderCustomizer jacksonCustomizer() {
return jackson2ObjectMapperBuilder -> jackson2ObjectMapperBuilder.serializers(new ZonedDateTimeSerializer(ISO_FIXED_FORMAT));
}
}

View File

@ -25,6 +25,7 @@ public class LoggingConfiguration {
@Value("${server.port}")
private String serverPort;
@Inject
private JHipsterProperties jHipsterProperties;

View File

@ -52,8 +52,8 @@ public class AuditEventConverter {
Map<String, Object> results = new HashMap<>();
if (data != null) {
for (String key : data.keySet()) {
results.put(key, data.get(key));
for (Map.Entry<String, String> entry : data.entrySet()) {
results.put(entry.getKey(), entry.getValue());
}
}
return results;
@ -70,8 +70,8 @@ public class AuditEventConverter {
Map<String, String> results = new HashMap<>();
if (data != null) {
for (String key : data.keySet()) {
Object object = data.get(key);
for (Map.Entry<String, Object> entry : data.entrySet()) {
Object object = entry.getValue();
// Extract the data that will be saved.
if (object instanceof WebAuthenticationDetails) {
@ -79,9 +79,9 @@ public class AuditEventConverter {
results.put("remoteAddress", authenticationDetails.getRemoteAddress());
results.put("sessionId", authenticationDetails.getSessionId());
} else if (object != null) {
results.put(key, object.toString());
results.put(entry.getKey(), object.toString());
} else {
results.put(key, "null");
results.put(entry.getKey(), "null");
}
}
}

View File

@ -69,7 +69,7 @@ public class ExceptionTranslator {
}
@ExceptionHandler(Exception.class)
public ResponseEntity<ErrorVM> processRuntimeException(Exception ex) throws Exception {
public ResponseEntity<ErrorVM> processRuntimeException(Exception ex) {
BodyBuilder builder;
ErrorVM errorVM;
ResponseStatus responseStatus = AnnotationUtils.findAnnotation(ex.getClass(), ResponseStatus.class);

View File

@ -7,10 +7,13 @@ import org.springframework.http.HttpHeaders;
/**
* Utility class for HTTP headers creation.
*/
public class HeaderUtil {
public final class HeaderUtil {
private static final Logger log = LoggerFactory.getLogger(HeaderUtil.class);
private HeaderUtil(){
}
public static HttpHeaders createAlert(String message, String param) {
HttpHeaders headers = new HttpHeaders();
headers.add("X-jhipsterSampleApplicationApp-alert", message);

View File

@ -13,7 +13,10 @@ import java.net.URISyntaxException;
* Pagination uses the same principles as the <a href="https://developer.github.com/v3/#pagination">Github API</a>,
* and follow <a href="http://tools.ietf.org/html/rfc5988">RFC 5988 (Link header)</a>.
*/
public class PaginationUtil {
public final class PaginationUtil {
private PaginationUtil(){
}
public static HttpHeaders generatePaginationHttpHeaders(Page<?> page, String baseUrl)
throws URISyntaxException {

View File

@ -13,6 +13,7 @@
spring:
profiles:
active: dev
include: swagger
devtools:
restart:

View File

@ -49,7 +49,7 @@
<constraints nullable="true"/>
</column>
<column name="last_modified_by" type="varchar(50)"/>
<column name="last_modified_date" type="timestamp" defaultValueDate="${now}"/>
<column name="last_modified_date" type="timestamp"/>
</createTable>
<createIndex indexName="idx_user_login"

View File

@ -38,28 +38,28 @@
</cache>
<cache name="io.github.jhipster.sample.domain.BankAccount"
timeToLiveSeconds="3600">
</cache>
timeToLiveSeconds="3600">
</cache>
<cache name="io.github.jhipster.sample.domain.BankAccount.operations"
timeToLiveSeconds="3600">
</cache>
timeToLiveSeconds="3600">
</cache>
<cache name="io.github.jhipster.sample.domain.Label"
timeToLiveSeconds="3600">
</cache>
timeToLiveSeconds="3600">
</cache>
<cache name="io.github.jhipster.sample.domain.Label.operations"
timeToLiveSeconds="3600">
</cache>
timeToLiveSeconds="3600">
</cache>
<cache name="io.github.jhipster.sample.domain.Operation"
timeToLiveSeconds="3600">
</cache>
timeToLiveSeconds="3600">
</cache>
<cache name="io.github.jhipster.sample.domain.Operation.labels"
timeToLiveSeconds="3600">
</cache>
timeToLiveSeconds="3600">
</cache>
<!-- jhipster-needle-ehcache-add-entry -->
</ehcache>

View File

@ -11,7 +11,7 @@
function capitalizeFilter (input) {
if (input !== null) {
input = input.toLowerCase();
input = input.substring(0, 1).toUpperCase() + input.substring(1)
input = input.substring(0, 1).toUpperCase() + input.substring(1);
}
return input;
}

View File

@ -23,11 +23,11 @@
var links = {};
// Parse each part into a named link
angular.forEach(parts, function(p) {
var section = p.split(';');
var section = p.split('>;');
if (section.length !== 2) {
throw new Error('section could not be split on ";"');
throw new Error('section could not be split on ">;"');
}
var url = section[0].replace(/<(.*)>/, '$1').trim();
var url = section[0].replace(/<(.*)/, '$1').trim();
var queryString = {};
url.replace(
new RegExp('([^?=&]+)(=([^&]*))?', 'g'),

View File

@ -43,12 +43,10 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
@SpringBootTest(classes = JhipsterSampleApplicationApp.class)
public class OperationResourceIntTest {
private static final DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").withZone(ZoneId.of("Z"));
private static final ZonedDateTime DEFAULT_DATE = ZonedDateTime.ofInstant(Instant.ofEpochMilli(0L), ZoneId.systemDefault());
private static final ZonedDateTime UPDATED_DATE = ZonedDateTime.now(ZoneId.systemDefault()).withNano(0);
private static final String DEFAULT_DATE_STR = dateTimeFormatter.format(DEFAULT_DATE);
private static final String DEFAULT_DATE_STR = DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(DEFAULT_DATE);
private static final String DEFAULT_DESCRIPTION = "AAAAA";
private static final String UPDATED_DESCRIPTION = "BBBBB";

View File

@ -2,7 +2,6 @@ package io.github.jhipster.sample.web.rest;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsr310.ser.ZonedDateTimeSerializer;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import org.springframework.http.MediaType;
@ -10,8 +9,6 @@ import java.io.IOException;
import java.nio.charset.Charset;
import java.time.ZonedDateTime;
import static io.github.jhipster.sample.config.JacksonConfiguration.ISO_FIXED_FORMAT;
/**
* Utility class for testing REST controllers.
*/
@ -36,7 +33,6 @@ public class TestUtil {
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
JavaTimeModule module = new JavaTimeModule();
module.addSerializer(ZonedDateTime.class, new ZonedDateTimeSerializer(ISO_FIXED_FORMAT));
mapper.registerModule(module);
return mapper.writeValueAsBytes(object);

View File

@ -10,6 +10,7 @@
# http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html
# ===================================================================
spring:
application:
name: jhipsterSampleApplication