automatic project update

This commit is contained in:
Julien Dubois 2016-08-17 17:03:45 +02:00
parent 208e587b6e
commit 3aefd9b0c6
459 changed files with 33208 additions and 13650 deletions

View File

@ -24,7 +24,7 @@
"en"
],
"serverPort": 8080,
"jhipsterVersion": "3.5.1",
"jhipsterVersion": "3.6.0",
"enableSocialSignIn": false,
"useSass": false,
"jhiPrefix": "jhi"

View File

@ -4,49 +4,49 @@
"appPath": "src/main/webapp/",
"testPath": "src/test/javascript/spec",
"dependencies": {
"angular": "1.5.5",
"angular-aria": "1.5.5",
"angular": "1.5.8",
"angular-aria": "1.5.8",
"angular-bootstrap": "1.3.3",
"angular-cache-buster": "0.4.3",
"angular-cookies": "1.5.5",
"angular-cookies": "1.5.8",
"angular-dynamic-locale": "0.1.32",
"angular-i18n": "1.5.5",
"angular-i18n": "1.5.8",
"ngstorage": "0.3.10",
"angular-loading-bar": "0.9.0",
"angular-resource": "1.5.5",
"angular-sanitize": "1.5.5",
"angular-translate": "2.11.0",
"angular-translate-interpolation-messageformat": "2.11.0",
"angular-translate-loader-partial": "2.11.0",
"angular-translate-storage-cookie": "2.11.0",
"angular-ui-router": "0.3.0",
"angular-resource": "1.5.8",
"angular-sanitize": "1.5.8",
"angular-translate": "2.11.1",
"angular-translate-interpolation-messageformat": "2.11.1",
"angular-translate-loader-partial": "2.11.1",
"angular-translate-storage-cookie": "2.11.1",
"angular-ui-router": "0.3.1",
"bootstrap": "3.3.6",
"bootstrap-ui-datetime-picker": "2.4.0",
"jquery": "2.2.4",
"bootstrap-ui-datetime-picker": "2.4.3",
"jquery": "3.1.0",
"json3": "3.3.2",
"messageformat": "0.3.1",
"modernizr": "3.3.1",
"ng-file-upload": "12.0.4",
"ngInfiniteScroll": "1.2.2",
"swagger-ui": "2.1.4"
"ngInfiniteScroll": "1.3.0",
"swagger-ui": "2.1.5"
},
"devDependencies": {
"angular-mocks": "1.5.5"
"angular-mocks": "1.5.8"
},
"overrides": {
"angular": {
"dependencies": {
"jquery": "2.2.4"
"jquery": "3.1.0"
}
},
"angular-cache-buster": {
"dependencies": {
"angular": "1.5.5"
"angular": "1.5.8"
}
},
"angular-dynamic-locale": {
"dependencies": {
"angular": "1.5.5"
"angular": "1.5.8"
}
},
"bootstrap": {
@ -56,9 +56,8 @@
}
},
"resolutions": {
"angular": "1.5.5",
"angular-cookies": "1.5.5",
"angular-bootstrap": "1.3.3",
"jquery": "2.2.4"
"angular": "1.5.8",
"angular-bootstrap": "2.0.0",
"jquery": "3.1.0"
}
}

View File

@ -1,3 +1,5 @@
'use strict';
var fs = require('fs'),
gulp = require('gulp'),
lazypipe = require('lazypipe'),
@ -13,13 +15,12 @@ var fs = require('fs'),
revReplace = require("gulp-rev-replace"),
plumber = require('gulp-plumber'),
gulpIf = require('gulp-if'),
handleErrors = require('./handleErrors');
handleErrors = require('./handle-errors');
var config = require('./config');
var initTask = lazypipe()
.pipe(sourcemaps.init)
.pipe(footer, ';');
.pipe(sourcemaps.init);
var jsTask = lazypipe()
.pipe(ngAnnotate)
.pipe(uglify);

View File

@ -1,6 +1,9 @@
'use strict';
module.exports = {
app: 'src/main/webapp/',
dist: 'target/www/',
swaggerDist: 'target/www/swagger-ui/',
test: 'src/test/javascript/',
bower: 'src/main/webapp/bower_components/',
tmp: 'target/tmp',

102
gulp/copy.js Normal file
View File

@ -0,0 +1,102 @@
'use strict';
var gulp = require('gulp'),
rev = require('gulp-rev'),
plumber = require('gulp-plumber'),
es = require('event-stream'),
flatten = require('gulp-flatten'),
replace = require('gulp-replace'),
bowerFiles = require('main-bower-files'),
changed = require('gulp-changed');
var handleErrors = require('./handle-errors');
var config = require('./config');
module.exports = {
i18n: i18n,
languages: languages,
fonts: fonts,
common: common,
swagger: swagger,
images: images
}
var yorc = require('../.yo-rc.json')['generator-jhipster'];
function i18n() {
return gulp.src(config.app + 'i18n/**')
.pipe(plumber({errorHandler: handleErrors}))
.pipe(changed(config.dist + 'i18n/'))
.pipe(gulp.dest(config.dist + 'i18n/'));
}
function languages() {
var locales = yorc.languages.map(function (locale) {
return config.bower + 'angular-i18n/angular-locale_' + locale + '.js';
});
return gulp.src(locales)
.pipe(plumber({errorHandler: handleErrors}))
.pipe(changed(config.app + 'i18n/'))
.pipe(gulp.dest(config.app + 'i18n/'));
}
function fonts() {
return es.merge(gulp.src(config.bower + 'bootstrap/fonts/*.*')
.pipe(plumber({errorHandler: handleErrors}))
.pipe(changed(config.dist + 'content/fonts/'))
.pipe(rev())
.pipe(gulp.dest(config.dist + 'content/fonts/'))
.pipe(rev.manifest(config.revManifest, {
base: config.dist,
merge: true
}))
.pipe(gulp.dest(config.dist)),
gulp.src(config.app + 'content/**/*.{woff,woff2,svg,ttf,eot,otf}')
.pipe(plumber({errorHandler: handleErrors}))
.pipe(changed(config.dist + 'content/fonts/'))
.pipe(flatten())
.pipe(rev())
.pipe(gulp.dest(config.dist + 'content/fonts/'))
.pipe(rev.manifest(config.revManifest, {
base: config.dist,
merge: true
}))
.pipe(gulp.dest(config.dist))
);
}
function common() {
return gulp.src([config.app + 'robots.txt', config.app + 'favicon.ico', config.app + '.htaccess'], { dot: true })
.pipe(plumber({errorHandler: handleErrors}))
.pipe(changed(config.dist))
.pipe(gulp.dest(config.dist));
}
function swagger() {
return es.merge(
gulp.src([config.bower + 'swagger-ui/dist/**',
'!' + config.bower + 'swagger-ui/dist/index.html',
'!' + config.bower + 'swagger-ui/dist/swagger-ui.min.js',
'!' + config.bower + 'swagger-ui/dist/swagger-ui.js'])
.pipe(plumber({errorHandler: handleErrors}))
.pipe(changed(config.swaggerDist))
.pipe(gulp.dest(config.swaggerDist)),
gulp.src(config.app + 'swagger-ui/index.html')
.pipe(plumber({errorHandler: handleErrors}))
.pipe(changed(config.swaggerDist))
.pipe(replace('../bower_components/swagger-ui/dist/', ''))
.pipe(replace('swagger-ui.js', 'lib/swagger-ui.min.js'))
.pipe(gulp.dest(config.swaggerDist)),
gulp.src(config.bower + 'swagger-ui/dist/swagger-ui.min.js')
.pipe(plumber({errorHandler: handleErrors}))
.pipe(changed(config.swaggerDist + 'lib/'))
.pipe(gulp.dest(config.swaggerDist + 'lib/'))
);
}
function images() {
return gulp.src(bowerFiles({filter: ['**/*.{gif,jpg,png}']}), { base: config.bower })
.pipe(plumber({errorHandler: handleErrors}))
.pipe(changed(config.dist + 'bower_components'))
.pipe(gulp.dest(config.dist + 'bower_components'));
}

22
gulp/handle-errors.js Normal file
View File

@ -0,0 +1,22 @@
'use strict';
var notify = require("gulp-notify");
var argv = require('yargs').argv;
module.exports = function() {
var args = Array.prototype.slice.call(arguments);
var notification = argv.notification === undefined ? true : argv.notification;
// Send error to notification center with gulp-notify
if(notification) {
notify.onError({
title: "JHipster Gulp Build",
subtitle: "Failure!",
message: "Error: <%= error.message %>",
sound: "Beep"
}).apply(this, args);
}
// Keep gulp from hanging on this task
this.emit('end');
};

68
gulp/inject.js Normal file
View File

@ -0,0 +1,68 @@
'use strict';
var gulp = require('gulp'),
plumber = require('gulp-plumber'),
inject = require('gulp-inject'),
es = require('event-stream'),
naturalSort = require('gulp-natural-sort'),
angularFilesort = require('gulp-angular-filesort'),
bowerFiles = require('main-bower-files');
var handleErrors = require('./handle-errors');
var config = require('./config');
module.exports = {
app: app,
vendor: vendor,
test: test,
troubleshoot: troubleshoot
}
function app() {
return gulp.src(config.app + 'index.html')
.pipe(inject(gulp.src(config.app + 'app/**/*.js')
.pipe(naturalSort())
.pipe(angularFilesort()), {relative: true}))
.pipe(gulp.dest(config.app));
}
function vendor() {
var stream = gulp.src(config.app + 'index.html')
.pipe(plumber({errorHandler: handleErrors}))
.pipe(inject(gulp.src(bowerFiles(), {read: false}), {
name: 'bower',
relative: true
}))
.pipe(gulp.dest(config.app));
return stream;
}
function test() {
return gulp.src(config.test + 'karma.conf.js')
.pipe(plumber({errorHandler: handleErrors}))
.pipe(inject(gulp.src(bowerFiles({includeDev: true, filter: ['**/*.js']}), {read: false}), {
starttag: '// bower:js',
endtag: '// endbower',
transform: function (filepath) {
return '\'' + filepath.substring(1, filepath.length) + '\',';
}
}))
.pipe(gulp.dest(config.test));
}
function troubleshoot() {
/* this task removes the troubleshooting content from index.html*/
return gulp.src(config.app + 'index.html')
.pipe(plumber({errorHandler: handleErrors}))
/* having empty src as we dont have to read any files*/
.pipe(inject(gulp.src('', {read: false}), {
starttag: '<!-- inject:troubleshoot -->',
removeTags: true,
transform: function () {
return '<!-- Angular views -->';
}
}))
.pipe(gulp.dest(config.app));
}

View File

@ -1,3 +1,5 @@
'use strict';
var gulp = require('gulp'),
util = require('./utils'),
url = require('url'),

View File

@ -1,4 +1,4 @@
// Generated on 2016-07-22 using generator-jhipster 3.5.1
// Generated on 2016-08-17 using generator-jhipster 3.6.0
'use strict';
var gulp = require('gulp'),
@ -8,71 +8,44 @@ var gulp = require('gulp'),
imagemin = require('gulp-imagemin'),
ngConstant = require('gulp-ng-constant'),
rename = require('gulp-rename'),
replace = require('gulp-replace'),
eslint = require('gulp-eslint'),
argv = require('yargs').argv,
gutil = require('gulp-util'),
protractor = require('gulp-protractor').protractor,
es = require('event-stream'),
flatten = require('gulp-flatten'),
del = require('del'),
runSequence = require('run-sequence'),
browserSync = require('browser-sync'),
KarmaServer = require('karma').Server,
plumber = require('gulp-plumber'),
changed = require('gulp-changed'),
gulpIf = require('gulp-if'),
inject = require('gulp-inject'),
angularFilesort = require('gulp-angular-filesort'),
naturalSort = require('gulp-natural-sort'),
bowerFiles = require('main-bower-files');
gulpIf = require('gulp-if');
var handleErrors = require('./gulp/handleErrors'),
var handleErrors = require('./gulp/handle-errors'),
serve = require('./gulp/serve'),
util = require('./gulp/utils'),
copy = require('./gulp/copy'),
inject = require('./gulp/inject'),
build = require('./gulp/build');
var yorc = require('./.yo-rc.json')['generator-jhipster'];
var config = require('./gulp/config');
gulp.task('clean', function () {
return del([config.dist], { dot: true });
});
gulp.task('copy', function () {
return es.merge(
gulp.src(config.app + 'i18n/**')
.pipe(plumber({errorHandler: handleErrors}))
.pipe(changed(config.dist + 'i18n/'))
.pipe(gulp.dest(config.dist + 'i18n/')),
gulp.src(config.bower + 'bootstrap/fonts/*.*')
.pipe(plumber({errorHandler: handleErrors}))
.pipe(changed(config.dist + 'content/fonts/'))
.pipe(rev())
.pipe(gulp.dest(config.dist + 'content/fonts/'))
.pipe(rev.manifest(config.revManifest, {
base: config.dist,
merge: true
}))
.pipe(gulp.dest(config.dist)),
gulp.src(config.app + 'content/**/*.{woff,woff2,svg,ttf,eot,otf}')
.pipe(plumber({errorHandler: handleErrors}))
.pipe(changed(config.dist + 'content/fonts/'))
.pipe(flatten())
.pipe(rev())
.pipe(gulp.dest(config.dist + 'content/fonts/'))
.pipe(rev.manifest(config.revManifest, {
base: config.dist,
merge: true
}))
.pipe(gulp.dest(config.dist)),
gulp.src([config.app + 'robots.txt', config.app + 'favicon.ico', config.app + '.htaccess'], { dot: true })
.pipe(plumber({errorHandler: handleErrors}))
.pipe(changed(config.dist))
.pipe(gulp.dest(config.dist))
);
});
gulp.task('copy', ['copy:i18n', 'copy:fonts', 'copy:common']);
gulp.task('copy:i18n', copy.i18n);
gulp.task('copy:languages', copy.languages);
gulp.task('copy:fonts', copy.fonts);
gulp.task('copy:common', copy.common);
gulp.task('copy:swagger', copy.swagger);
gulp.task('copy:images', copy.images);
gulp.task('images', function () {
return gulp.src(config.app + 'content/images/**')
@ -90,73 +63,26 @@ gulp.task('images', function () {
});
gulp.task('languages', function () {
var locales = yorc.languages.map(function (locale) {
return config.bower + 'angular-i18n/angular-locale_' + locale + '.js';
});
return gulp.src(locales)
.pipe(plumber({errorHandler: handleErrors}))
.pipe(changed(config.app + 'i18n/'))
.pipe(gulp.dest(config.app + 'i18n/'));
});
gulp.task('styles', [], function () {
return gulp.src(config.app + 'content/css')
.pipe(browserSync.reload({stream: true}));
});
gulp.task('inject', ['inject:dep', 'inject:app']);
gulp.task('inject', function() {
runSequence('inject:dep', 'inject:app');
});
gulp.task('inject:dep', ['inject:test', 'inject:vendor']);
gulp.task('inject:app', function () {
return gulp.src(config.app + 'index.html')
.pipe(inject(gulp.src(config.app + 'app/**/*.js')
.pipe(naturalSort())
.pipe(angularFilesort()), {relative: true}))
.pipe(gulp.dest(config.app));
});
gulp.task('inject:app', inject.app);
gulp.task('inject:vendor', function () {
var stream = gulp.src(config.app + 'index.html')
.pipe(plumber({errorHandler: handleErrors}))
.pipe(inject(gulp.src(bowerFiles(), {read: false}), {
name: 'bower',
relative: true
}))
.pipe(gulp.dest(config.app));
gulp.task('inject:vendor', inject.vendor);
return stream;
});
gulp.task('inject:test', inject.test);
gulp.task('inject:test', function () {
return gulp.src(config.test + 'karma.conf.js')
.pipe(plumber({errorHandler: handleErrors}))
.pipe(inject(gulp.src(bowerFiles({includeDev: true, filter: ['**/*.js']}), {read: false}), {
starttag: '// bower:js',
endtag: '// endbower',
transform: function (filepath) {
return '\'' + filepath.substring(1, filepath.length) + '\',';
}
}))
.pipe(gulp.dest(config.test));
});
gulp.task('inject:troubleshoot', inject.troubleshoot);
gulp.task('inject:troubleshoot', function () {
/* this task removes the troubleshooting content from index.html*/
return gulp.src(config.app + 'index.html')
.pipe(plumber({errorHandler: handleErrors}))
/* having empty src as we dont have to read any files*/
.pipe(inject(gulp.src('', {read: false}), {
starttag: '<!-- inject:troubleshoot -->',
removeTags: true,
transform: function () {
return '<!-- Angular views -->';
}
}))
.pipe(gulp.dest(config.app));
});
gulp.task('assets:prod', ['images', 'styles', 'html','swagger-ui'], build);
gulp.task('assets:prod', ['images', 'styles', 'html', 'copy:swagger', 'copy:images'], build);
gulp.task('html', function () {
return gulp.src(config.app + 'app/**/*.html')
@ -169,22 +95,6 @@ gulp.task('html', function () {
.pipe(gulp.dest(config.tmp));
});
gulp.task('swagger-ui', function () {
return es.merge(
gulp.src([config.bower + 'swagger-ui/dist/**',
'!' + config.bower + 'swagger-ui/dist/index.html',
'!' + config.bower + 'swagger-ui/dist/swagger-ui.min.js',
'!' + config.bower + 'swagger-ui/dist/swagger-ui.js'])
.pipe(gulp.dest(config.dist + 'swagger-ui/')),
gulp.src(config.app + 'swagger-ui/index.html')
.pipe(replace('../bower_components/swagger-ui/dist/', ''))
.pipe(replace('swagger-ui.js', 'lib/swagger-ui.min.js'))
.pipe(gulp.dest(config.dist + 'swagger-ui/')),
gulp.src(config.bower + 'swagger-ui/dist/swagger-ui.min.js')
.pipe(gulp.dest(config.dist + 'swagger-ui/lib/'))
);
});
gulp.task('ngconstant:dev', function () {
return ngConstant({
name: 'jhipsterSampleApplicationApp',
@ -269,15 +179,13 @@ gulp.task('watch', function () {
});
gulp.task('install', function () {
runSequence(['inject:dep', 'ngconstant:dev'], 'languages', 'inject:app', 'inject:troubleshoot');
runSequence(['inject:dep', 'ngconstant:dev'], 'copy:languages', 'inject:app', 'inject:troubleshoot');
});
gulp.task('serve', function () {
runSequence('install', serve);
});
gulp.task('serve', ['install'], serve);
gulp.task('build', ['clean'], function (cb) {
runSequence(['copy', 'inject:vendor', 'ngconstant:prod', 'languages'], 'inject:app', 'inject:troubleshoot', 'assets:prod', cb);
runSequence(['copy', 'inject:vendor', 'ngconstant:prod', 'copy:languages'], 'inject:app', 'inject:troubleshoot', 'assets:prod', cb);
});
gulp.task('default', ['serve']);

View File

@ -9,24 +9,24 @@
],
"devDependencies": {
"bower": "1.7.9",
"browser-sync": "2.12.10",
"del": "2.2.0",
"browser-sync": "2.13.0",
"del": "2.2.1",
"eslint-config-angular": "0.5.0",
"eslint-plugin-angular": "1.0.1",
"event-stream": "3.3.2",
"generator-jhipster": "3.5.1",
"eslint-plugin-angular": "1.3.1",
"event-stream": "3.3.4",
"generator-jhipster": "3.6.0",
"gulp": "3.9.1",
"gulp-angular-filesort": "1.1.1",
"gulp-angular-templatecache": "1.9.0",
"gulp-angular-templatecache": "2.0.0",
"gulp-autoprefixer": "3.1.0",
"gulp-changed": "1.3.0",
"gulp-changed": "1.3.1",
"gulp-cssnano": "2.1.2",
"gulp-eslint": "2.0.0",
"gulp-flatten": "0.2.0",
"gulp-eslint": "3.0.1",
"gulp-flatten": "0.3.0",
"gulp-footer": "1.0.5",
"gulp-htmlmin": "2.0.0",
"gulp-if": "2.0.1",
"gulp-imagemin": "3.0.1",
"gulp-imagemin": "3.0.2",
"gulp-inject": "4.1.0",
"gulp-natural-sort": "0.1.1",
"gulp-ng-annotate": "2.0.0",
@ -35,33 +35,33 @@
"gulp-plumber": "1.1.0",
"gulp-rename": "1.2.2",
"gulp-replace": "0.5.4",
"gulp-protractor": "2.4.0",
"gulp-protractor": "3.0.0",
"gulp-util": "3.0.7",
"gulp-rev": "7.0.0",
"gulp-rev": "7.1.0",
"gulp-rev-replace": "0.4.3",
"gulp-sourcemaps": "1.6.0",
"gulp-uglify": "1.5.3",
"gulp-uglify": "1.5.4",
"gulp-useref": "3.1.0",
"jasmine-core": "2.4.1",
"jasmine-reporters": "2.1.1",
"karma": "0.13.22",
"jasmine-reporters": "2.2.0",
"karma": "1.1.2",
"karma-chrome-launcher": "1.0.1",
"karma-coverage": "1.0.0",
"karma-coverage": "1.1.1",
"karma-jasmine": "1.0.2",
"karma-junit-reporter": "1.0.0",
"karma-phantomjs-launcher": "1.0.0",
"karma-junit-reporter": "1.1.0",
"karma-phantomjs-launcher": "1.0.1",
"karma-script-launcher": "1.0.0",
"lazypipe": "1.0.1",
"lodash": "4.13.1",
"lodash": "4.14.0",
"main-bower-files": "2.13.1",
"map-stream": "0.0.6",
"phantomjs-prebuilt": "2.1.7",
"protractor": "3.3.0",
"protractor-jasmine2-screenshot-reporter": "0.3.1",
"phantomjs-prebuilt": "2.1.8",
"protractor": "4.0.3",
"protractor-jasmine2-screenshot-reporter": "0.3.2",
"proxy-middleware": "0.15.0",
"run-sequence": "1.2.1",
"run-sequence": "1.2.2",
"xml2js": "0.4.16",
"yargs": "4.7.1"
"yargs": "4.8.1"
},
"engines": {
"node": "^4.3"

19
pom.xml
View File

@ -5,7 +5,7 @@
<parent>
<artifactId>spring-boot-starter-parent</artifactId>
<groupId>org.springframework.boot</groupId>
<version>1.3.6.RELEASE</version>
<version>1.4.0.RELEASE</version>
<relativePath/>
</parent>
@ -21,9 +21,9 @@
<properties>
<hikaricp.version>2.4.6</hikaricp.version>
<assertj-core.version>3.3.0</assertj-core.version>
<assertj-core.version>3.5.2</assertj-core.version>
<awaitility.version>1.7.0</awaitility.version>
<commons-io.version>2.4</commons-io.version>
<commons-io.version>2.5</commons-io.version>
<commons-lang.version>2.6</commons-lang.version>
<frontend-maven-plugin.version>1.0</frontend-maven-plugin.version>
<gatling.version>2.1.7</gatling.version>
@ -34,23 +34,23 @@
<maven.compiler.target>${java.version}</maven.compiler.target>
<javax.inject.version>1</javax.inject.version>
<liquibase.version>3.4.2</liquibase.version>
<liquibase-slf4j.version>1.2.1</liquibase-slf4j.version>
<liquibase-slf4j.version>2.0.0</liquibase-slf4j.version>
<liquibase-hibernate4.version>3.5</liquibase-hibernate4.version>
<mapstruct.version>1.0.0.Final</mapstruct.version>
<maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format>
<maven-enforcer-plugin.version>1.4.1</maven-enforcer-plugin.version>
<maven-resources-plugin.version>3.0.0</maven-resources-plugin.version>
<maven-resources-plugin.version>3.0.1</maven-resources-plugin.version>
<sortpom-maven-plugin.version>2.5.0</sortpom-maven-plugin.version>
<metrics-spark-reporter.version>1.2</metrics-spark-reporter.version>
<metrics-spring.version>3.1.3</metrics-spring.version>
<logstash-logback-encoder.version>4.6</logstash-logback-encoder.version>
<logstash-logback-encoder.version>4.7</logstash-logback-encoder.version>
<run.addResources>false</run.addResources>
<spring-security.version>4.1.0.RELEASE</spring-security.version>
<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>
<jacoco-maven-plugin.version>0.7.6.201602180812</jacoco-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>
<sonar.jacoco.itReportPath>${project.testresult.directory}/coverage/jacoco/jacoco-it.exec</sonar.jacoco.itReportPath>
@ -315,6 +315,11 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>

View File

@ -5,7 +5,7 @@ services:
external_links:
- jhipstersampleapplication-mysql:mysql
environment:
- SPRING_PROFILES_ACTIVE=prod
- SPRING_PROFILES_ACTIVE=prod,swagger
- SPRING_DATASOURCE_URL=jdbc:mysql://mysql:3306/jhipstersampleapplication?useUnicode=true&characterEncoding=utf8&useSSL=false
- JHIPSTER_SLEEP=10 # gives time for the database to boot before the application
ports:

View File

@ -2,7 +2,7 @@ package io.github.jhipster.sample;
import io.github.jhipster.sample.config.DefaultProfileUtil;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.web.SpringBootServletInitializer;
import org.springframework.boot.web.support.SpringBootServletInitializer;
/**
* This is a helper Java class that provides an alternative to creating a web.xml.

View File

@ -33,8 +33,10 @@ public class LoggingAspect {
@AfterThrowing(pointcut = "loggingPointcut()", throwing = "e")
public void logAfterThrowing(JoinPoint joinPoint, Throwable e) {
if (env.acceptsProfiles(Constants.SPRING_PROFILE_DEVELOPMENT)) {
log.error("Exception in {}.{}() with cause = {} and exception {}", joinPoint.getSignature().getDeclaringTypeName(),
joinPoint.getSignature().getName(), e.getCause(), e);
log.error("Exception in {}.{}() with cause = \'{}\' and exception = \'{}\'", joinPoint.getSignature().getDeclaringTypeName(),
joinPoint.getSignature().getName(), e.getCause(), e.getMessage());
e.printStackTrace();
} else {
log.error("Exception in {}.{}() with cause = {}", joinPoint.getSignature().getDeclaringTypeName(),
joinPoint.getSignature().getName(), e.getCause());

View File

@ -2,20 +2,12 @@ package io.github.jhipster.sample.config;
import io.github.jhipster.sample.config.liquibase.AsyncSpringLiquibase;
import com.codahale.metrics.MetricRegistry;
import com.fasterxml.jackson.datatype.hibernate4.Hibernate4Module;
import com.zaxxer.hikari.HikariDataSource;
import liquibase.integration.spring.SpringLiquibase;
import org.h2.tools.Server;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
import org.springframework.boot.autoconfigure.liquibase.LiquibaseProperties;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.ApplicationContextException;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
@ -27,7 +19,6 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
import javax.inject.Inject;
import javax.sql.DataSource;
import java.sql.SQLException;
import java.util.Arrays;
@Configuration
@EnableJpaRepositories("io.github.jhipster.sample.repository")
@ -40,35 +31,6 @@ public class DatabaseConfiguration {
@Inject
private Environment env;
@Autowired(required = false)
private MetricRegistry metricRegistry;
@Bean(destroyMethod = "close")
@ConditionalOnExpression("#{!environment.acceptsProfiles('" + Constants.SPRING_PROFILE_CLOUD + "') && !environment.acceptsProfiles('" + Constants.SPRING_PROFILE_HEROKU + "')}")
@ConfigurationProperties(prefix = "spring.datasource.hikari")
public DataSource dataSource(DataSourceProperties dataSourceProperties) {
log.debug("Configuring Datasource");
if (dataSourceProperties.getUrl() == null) {
log.error("Your database connection pool configuration is incorrect! The application" +
" cannot start. Please check your Spring profile, current profiles are: {}",
Arrays.toString(env.getActiveProfiles()));
throw new ApplicationContextException("Database connection pool is not configured correctly");
}
HikariDataSource hikariDataSource = (HikariDataSource) DataSourceBuilder
.create(dataSourceProperties.getClassLoader())
.type(HikariDataSource.class)
.driverClassName(dataSourceProperties.getDriverClassName())
.url(dataSourceProperties.getUrl())
.username(dataSourceProperties.getUsername())
.password(dataSourceProperties.getPassword())
.build();
if (metricRegistry != null) {
hikariDataSource.setMetricRegistry(metricRegistry);
}
return hikariDataSource;
}
/**
* Open the TCP port for the H2 database, so it is available remotely.
@ -83,8 +45,7 @@ public class DatabaseConfiguration {
}
@Bean
public SpringLiquibase liquibase(DataSource dataSource, DataSourceProperties dataSourceProperties,
LiquibaseProperties liquibaseProperties) {
public SpringLiquibase liquibase(DataSource dataSource, LiquibaseProperties liquibaseProperties) {
// Use liquibase.integration.spring.SpringLiquibase if you don't want Liquibase to start asynchronously
SpringLiquibase liquibase = new AsyncSpringLiquibase();
@ -99,7 +60,6 @@ public class DatabaseConfiguration {
liquibase.setShouldRun(liquibaseProperties.isEnabled());
log.debug("Configuring Liquibase");
}
return liquibase;
}

View File

@ -27,6 +27,8 @@ public final class DefaultProfileUtil {
/**
* Get a default profile from <code>application.yml</code>.
*
* @return the default active profile
*/
public static String getDefaultActiveProfiles(){
if (BUILD_PROPERTIES != null) {
@ -43,6 +45,8 @@ public final class DefaultProfileUtil {
/**
* Set a default to use when no profile is configured.
*
* @param app the spring application
*/
public static void addDefaultProfile(SpringApplication app) {
Map<String, Object> defProperties = new HashMap<>();
@ -57,6 +61,8 @@ public final class DefaultProfileUtil {
/**
* Load application.yml from classpath.
*
* @return the YAML Properties
*/
private static Properties readProperties() {
try {

View File

@ -10,9 +10,12 @@ import com.codahale.metrics.health.HealthCheckRegistry;
import com.codahale.metrics.jvm.*;
import com.ryantenney.metrics.spring.config.annotation.EnableMetrics;
import com.ryantenney.metrics.spring.config.annotation.MetricsConfigurerAdapter;
import com.zaxxer.hikari.HikariDataSource;
import fr.ippon.spark.metrics.SparkReporter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.*;
@ -41,6 +44,9 @@ public class MetricsConfiguration extends MetricsConfigurerAdapter {
@Inject
private JHipsterProperties jHipsterProperties;
@Autowired(required = false)
private HikariDataSource hikariDataSource;
@Override
@Bean
public MetricRegistry getMetricRegistry() {
@ -61,6 +67,10 @@ public class MetricsConfiguration extends MetricsConfigurerAdapter {
metricRegistry.register(PROP_METRIC_REG_JVM_THREADS, new ThreadStatesGaugeSet());
metricRegistry.register(PROP_METRIC_REG_JVM_FILES, new FileDescriptorRatioGauge());
metricRegistry.register(PROP_METRIC_REG_JVM_BUFFERS, new BufferPoolMetricSet(ManagementFactory.getPlatformMBeanServer()));
if (hikariDataSource != null) {
log.debug("Monitoring the datasource");
hikariDataSource.setMetricRegistry(metricRegistry);
}
if (jHipsterProperties.getMetrics().getJmx().isEnabled()) {
log.debug("Initializing Metrics JMX reporting");
JmxReporter jmxReporter = JmxReporter.forRegistry(metricRegistry).build();

View File

@ -4,14 +4,15 @@ import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.servlet.InstrumentedFilter;
import com.codahale.metrics.servlets.MetricsServlet;
import io.github.jhipster.sample.web.filter.CachingHttpHeadersFilter;
import org.apache.catalina.webresources.StandardRoot;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
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.context.embedded.ServletContextInitializer;
import org.springframework.boot.context.embedded.*;
import org.springframework.boot.context.embedded.tomcat.*;
import org.springframework.boot.web.servlet.ServletContextInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
@ -59,7 +60,7 @@ public class WebConfigurer implements ServletContextInitializer, EmbeddedServlet
}
/**
* Set up Mime types and, if needed, set the document root.
* Customize the Tomcat engine: Mime types, the document root, the cache.
*/
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
@ -69,11 +70,27 @@ public class WebConfigurer implements ServletContextInitializer, EmbeddedServlet
// CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
mappings.add("json", "text/html;charset=utf-8");
container.setMimeMappings(mappings);
customizeTomcat(container);
// When running in an IDE or with ./mvnw spring-boot:run, set location of the static web assets.
setLocationForStaticAssets(container);
}
/**
* Customize Tomcat configuration.
*/
private void customizeTomcat(ConfigurableEmbeddedServletContainer container) {
if (container instanceof TomcatEmbeddedServletContainerFactory) {
TomcatEmbeddedServletContainerFactory tomcatFactory = (TomcatEmbeddedServletContainerFactory) container;
tomcatFactory.addContextCustomizers((TomcatContextCustomizer) context -> {
// See https://github.com/jhipster/generator-jhipster/issues/3995
StandardRoot resources = new StandardRoot();
resources.setCacheMaxSize(40960);
resources.setCacheObjectMaxSize(2048);
context.setResources(resources);
});
}
}
private void setLocationForStaticAssets(ConfigurableEmbeddedServletContainer container) {
File root;
String prefixPath = resolvePathPrefix();

View File

@ -32,6 +32,13 @@ public class CustomAuditEventRepository implements AuditEventRepository {
@Inject
private AuditEventConverter auditEventConverter;
@Override
public List<AuditEvent> find(Date after) {
Iterable<PersistentAuditEvent> persistentAuditEvents =
persistenceAuditEventRepository.findByAuditEventDateAfter(LocalDateTime.from(after.toInstant()));
return auditEventConverter.convertToAuditEvent(persistentAuditEvents);
}
@Override
public List<AuditEvent> find(String principal, Date after) {
Iterable<PersistentAuditEvent> persistentAuditEvents;
@ -46,6 +53,13 @@ public class CustomAuditEventRepository implements AuditEventRepository {
return auditEventConverter.convertToAuditEvent(persistentAuditEvents);
}
@Override
public List<AuditEvent> find(String principal, Date after, String type) {
Iterable<PersistentAuditEvent> persistentAuditEvents =
persistenceAuditEventRepository.findByPrincipalAndAuditEventDateAfterAndAuditEventType(principal, LocalDateTime.from(after.toInstant()), type);
return auditEventConverter.convertToAuditEvent(persistentAuditEvents);
}
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void add(AuditEvent event) {

View File

@ -16,7 +16,11 @@ public interface PersistenceAuditEventRepository extends JpaRepository<Persisten
List<PersistentAuditEvent> findByPrincipal(String principal);
List<PersistentAuditEvent> findByAuditEventDateAfter(LocalDateTime after);
List<PersistentAuditEvent> findByPrincipalAndAuditEventDateAfter(String principal, LocalDateTime after);
List<PersistentAuditEvent> findByPrincipalAndAuditEventDateAfterAndAuditEventType(String principle, LocalDateTime after, String type);
Page<PersistentAuditEvent> findAllByAuditEventDateBetween(LocalDateTime fromDate, LocalDateTime toDate, Pageable pageable);
}

View File

@ -3,7 +3,10 @@ package io.github.jhipster.sample.repository;
import io.github.jhipster.sample.domain.User;
import java.time.ZonedDateTime;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import java.util.List;
import java.util.Optional;
@ -25,6 +28,10 @@ public interface UserRepository extends JpaRepository<User, Long> {
Optional<User> findOneById(Long userId);
@Query(value = "select distinct user from User user join fetch user.authorities",
countQuery = "select count(user) from User user")
Page<User> findAllWithAuthorities(Pageable pageable);
@Override
void delete(User t);

View File

@ -8,7 +8,7 @@ import io.github.jhipster.sample.repository.UserRepository;
import io.github.jhipster.sample.security.AuthoritiesConstants;
import io.github.jhipster.sample.security.SecurityUtils;
import io.github.jhipster.sample.service.util.RandomUtil;
import io.github.jhipster.sample.web.rest.dto.ManagedUserDTO;
import io.github.jhipster.sample.web.rest.vm.ManagedUserVM;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
@ -33,7 +33,6 @@ public class UserService {
@Inject
private PasswordEncoder passwordEncoder;
@Inject
private UserRepository userRepository;
@ -84,7 +83,7 @@ public class UserService {
});
}
public User createUserInformation(String login, String password, String firstName, String lastName, String email,
public User createUser(String login, String password, String firstName, String lastName, String email,
String langKey) {
User newUser = new User();
@ -109,20 +108,20 @@ public class UserService {
return newUser;
}
public User createUser(ManagedUserDTO managedUserDTO) {
public User createUser(ManagedUserVM managedUserVM) {
User user = new User();
user.setLogin(managedUserDTO.getLogin());
user.setFirstName(managedUserDTO.getFirstName());
user.setLastName(managedUserDTO.getLastName());
user.setEmail(managedUserDTO.getEmail());
if (managedUserDTO.getLangKey() == null) {
user.setLogin(managedUserVM.getLogin());
user.setFirstName(managedUserVM.getFirstName());
user.setLastName(managedUserVM.getLastName());
user.setEmail(managedUserVM.getEmail());
if (managedUserVM.getLangKey() == null) {
user.setLangKey("en"); // default language
} else {
user.setLangKey(managedUserDTO.getLangKey());
user.setLangKey(managedUserVM.getLangKey());
}
if (managedUserDTO.getAuthorities() != null) {
if (managedUserVM.getAuthorities() != null) {
Set<Authority> authorities = new HashSet<>();
managedUserDTO.getAuthorities().stream().forEach(
managedUserVM.getAuthorities().stream().forEach(
authority -> authorities.add(authorityRepository.findOne(authority))
);
user.setAuthorities(authorities);
@ -137,7 +136,7 @@ public class UserService {
return user;
}
public void updateUserInformation(String firstName, String lastName, String email, String langKey) {
public void updateUser(String firstName, String lastName, String email, String langKey) {
userRepository.findOneByLogin(SecurityUtils.getCurrentUserLogin()).ifPresent(u -> {
u.setFirstName(firstName);
u.setLastName(lastName);
@ -148,7 +147,28 @@ public class UserService {
});
}
public void deleteUserInformation(String login) {
public void updateUser(Long id, String login, String firstName, String lastName, String email,
boolean activated, String langKey, Set<String> authorities) {
userRepository
.findOneById(id)
.ifPresent(u -> {
u.setLogin(login);
u.setFirstName(firstName);
u.setLastName(lastName);
u.setEmail(email);
u.setActivated(activated);
u.setLangKey(langKey);
Set<Authority> managedAuthorities = u.getAuthorities();
managedAuthorities.clear();
authorities.stream().forEach(
authority -> managedAuthorities.add(authorityRepository.findOne(authority))
);
log.debug("Changed Information for User: {}", u);
});
}
public void deleteUser(String login) {
userRepository.findOneByLogin(login).ifPresent(u -> {
userRepository.delete(u);
log.debug("Deleted User: {}", u);

View File

@ -1,4 +1,4 @@
package io.github.jhipster.sample.web.rest.dto;
package io.github.jhipster.sample.service.dto;
import io.github.jhipster.sample.config.Constants;

View File

@ -0,0 +1,4 @@
/**
* Data Transfer Objects.
*/
package io.github.jhipster.sample.service.dto;

View File

@ -1,8 +1,8 @@
package io.github.jhipster.sample.web.rest.mapper;
package io.github.jhipster.sample.service.mapper;
import io.github.jhipster.sample.domain.Authority;
import io.github.jhipster.sample.domain.User;
import io.github.jhipster.sample.web.rest.dto.UserDTO;
import io.github.jhipster.sample.service.dto.UserDTO;
import org.mapstruct.*;
import java.util.List;

View File

@ -0,0 +1,4 @@
/**
* MapStruct mappers for mapping domain objects and Data Transfer Objects.
*/
package io.github.jhipster.sample.service.mapper;

View File

@ -9,9 +9,9 @@ import io.github.jhipster.sample.repository.UserRepository;
import io.github.jhipster.sample.security.SecurityUtils;
import io.github.jhipster.sample.service.MailService;
import io.github.jhipster.sample.service.UserService;
import io.github.jhipster.sample.web.rest.dto.KeyAndPasswordDTO;
import io.github.jhipster.sample.web.rest.dto.ManagedUserDTO;
import io.github.jhipster.sample.web.rest.dto.UserDTO;
import io.github.jhipster.sample.service.dto.UserDTO;
import io.github.jhipster.sample.web.rest.vm.KeyAndPasswordVM;
import io.github.jhipster.sample.web.rest.vm.ManagedUserVM;
import io.github.jhipster.sample.web.rest.util.HeaderUtil;
import org.apache.commons.lang.StringUtils;
@ -54,7 +54,7 @@ public class AccountResource {
/**
* POST /register : register the user.
*
* @param managedUserDTO the managed user DTO
* @param managedUserVM the managed user View Model
* @param request the HTTP request
* @return the ResponseEntity with status 201 (Created) if the user is registered or 400 (Bad Request) if the login or e-mail is already in use
*/
@ -62,19 +62,19 @@ public class AccountResource {
method = RequestMethod.POST,
produces={MediaType.APPLICATION_JSON_VALUE, MediaType.TEXT_PLAIN_VALUE})
@Timed
public ResponseEntity<?> registerAccount(@Valid @RequestBody ManagedUserDTO managedUserDTO, HttpServletRequest request) {
public ResponseEntity<?> registerAccount(@Valid @RequestBody ManagedUserVM managedUserVM, HttpServletRequest request) {
HttpHeaders textPlainHeaders = new HttpHeaders();
textPlainHeaders.setContentType(MediaType.TEXT_PLAIN);
return userRepository.findOneByLogin(managedUserDTO.getLogin().toLowerCase())
return userRepository.findOneByLogin(managedUserVM.getLogin().toLowerCase())
.map(user -> new ResponseEntity<>("login already in use", textPlainHeaders, HttpStatus.BAD_REQUEST))
.orElseGet(() -> userRepository.findOneByEmail(managedUserDTO.getEmail())
.orElseGet(() -> userRepository.findOneByEmail(managedUserVM.getEmail())
.map(user -> new ResponseEntity<>("e-mail address already in use", textPlainHeaders, HttpStatus.BAD_REQUEST))
.orElseGet(() -> {
User user = userService.createUserInformation(managedUserDTO.getLogin(), managedUserDTO.getPassword(),
managedUserDTO.getFirstName(), managedUserDTO.getLastName(), managedUserDTO.getEmail().toLowerCase(),
managedUserDTO.getLangKey());
User user = userService.createUser(managedUserVM.getLogin(), managedUserVM.getPassword(),
managedUserVM.getFirstName(), managedUserVM.getLastName(), managedUserVM.getEmail().toLowerCase(),
managedUserVM.getLangKey());
String baseUrl = request.getScheme() + // "http"
"://" + // "://"
request.getServerName() + // "myhost"
@ -152,7 +152,7 @@ public class AccountResource {
return userRepository
.findOneByLogin(SecurityUtils.getCurrentUserLogin())
.map(u -> {
userService.updateUserInformation(userDTO.getFirstName(), userDTO.getLastName(), userDTO.getEmail(),
userService.updateUser(userDTO.getFirstName(), userDTO.getLastName(), userDTO.getEmail(),
userDTO.getLangKey());
return new ResponseEntity<String>(HttpStatus.OK);
})
@ -259,7 +259,7 @@ public class AccountResource {