Skip to content

Commit

Permalink
automatic project update
Browse files Browse the repository at this point in the history
  • Loading branch information
jdubois committed Nov 19, 2016
1 parent 5139398 commit 40e38a8
Show file tree
Hide file tree
Showing 24 changed files with 80 additions and 90 deletions.
24 changes: 18 additions & 6 deletions Jenkinsfile
@@ -1,4 +1,8 @@
node {
stage('checkout') {
checkout scm
}

// uncomment these 2 lines and edit the name 'node-4.6.0' according to what you choose in configuration
// def nodeHome = tool name: 'node-4.6.0', type: 'jenkins.plugins.nodejs.tools.NodeJSInstallation'
// env.PATH = "${nodeHome}/bin:${env.PATH}"
Expand All @@ -10,10 +14,6 @@ node {
sh "gulp -v"
}

stage('checkout') {
checkout scm
}

stage('npm install') {
sh "npm install"
}
Expand All @@ -23,11 +23,23 @@ node {
}

stage('backend tests') {
sh "./mvnw test"
try {
sh "./mvnw test"
} catch(err) {
throw err
} finally {
step([$class: 'JUnitResultArchiver', testResults: '**/target/surefire-reports/TEST-*.xml'])
}
}

stage('frontend tests') {
sh "gulp test"
try {
sh "gulp test"
} catch(err) {
throw err
} finally {
step([$class: 'JUnitResultArchiver', testResults: '**/target/test-results/karma/TESTS-*.xml'])
}
}

stage('packaging') {
Expand Down
14 changes: 7 additions & 7 deletions README.md
@@ -1,6 +1,6 @@
# jhipsterSampleApplication

This application was generated using JHipster 3.10.0, you can find documentation and help at [https://jhipster.github.io/documentation-archive/v3.10.0](https://jhipster.github.io/documentation-archive/v3.10.0).
This application was generated using JHipster 3.11.0, you can find documentation and help at [https://jhipster.github.io/documentation-archive/v3.11.0](https://jhipster.github.io/documentation-archive/v3.11.0).

## Development

Expand Down Expand Up @@ -93,13 +93,13 @@ For more information refer to [Using Docker and Docker-Compose][], this page als
To set up a CI environment, consult the [Setting up Continuous Integration][] page.

[JHipster Homepage and latest documentation]: https://jhipster.github.io
[JHipster 3.10.0 archive]: https://jhipster.github.io/documentation-archive/v3.10.0
[JHipster 3.11.0 archive]: https://jhipster.github.io/documentation-archive/v3.11.0

[Using JHipster in development]: https://jhipster.github.io/documentation-archive/v3.10.0/development/
[Using Docker and Docker-Compose]: https://jhipster.github.io/documentation-archive/v3.10.0/docker-compose
[Using JHipster in production]: https://jhipster.github.io/documentation-archive/v3.10.0/production/
[Running tests page]: https://jhipster.github.io/documentation-archive/v3.10.0/running-tests/
[Setting up Continuous Integration]: https://jhipster.github.io/documentation-archive/v3.10.0/setting-up-ci/
[Using JHipster in development]: https://jhipster.github.io/documentation-archive/v3.11.0/development/
[Using Docker and Docker-Compose]: https://jhipster.github.io/documentation-archive/v3.11.0/docker-compose
[Using JHipster in production]: https://jhipster.github.io/documentation-archive/v3.11.0/production/
[Running tests page]: https://jhipster.github.io/documentation-archive/v3.11.0/running-tests/
[Setting up Continuous Integration]: https://jhipster.github.io/documentation-archive/v3.11.0/setting-up-ci/

[Gatling]: http://gatling.io/
[Node.js]: https://nodejs.org/
Expand Down
2 changes: 1 addition & 1 deletion gulpfile.js
@@ -1,4 +1,4 @@
// Generated on 2016-11-14 using generator-jhipster 3.11.0
// Generated on 2016-11-19 using generator-jhipster 3.11.0
'use strict';

var gulp = require('gulp'),
Expand Down
5 changes: 5 additions & 0 deletions pom.xml
Expand Up @@ -219,6 +219,11 @@
<version>${gatling.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jzlib</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
Expand Down
Expand Up @@ -20,7 +20,7 @@ private DefaultProfileUtil() {
/**
* Set a default to use when no profile is configured.
*
* @param app the spring application
* @param app the Spring application
*/
public static void addDefaultProfile(SpringApplication app) {
Map<String, Object> defProperties = new HashMap<>();
Expand Down
Expand Up @@ -135,7 +135,7 @@ private void initMetrics(ServletContext servletContext, EnumSet<DispatcherType>
ServletRegistration.Dynamic metricsAdminServlet =
servletContext.addServlet("metricsServlet", new MetricsServlet());

metricsAdminServlet.addMapping("/management/jhipster/metrics/*");
metricsAdminServlet.addMapping("/management/metrics/*");
metricsAdminServlet.setAsyncSupported(true);
metricsAdminServlet.setLoadOnStartup(2);
}
Expand Down
Expand Up @@ -142,7 +142,7 @@ public void logout(HttpServletRequest request, HttpServletResponse response, Aut
} catch (InvalidCookieException ice) {
log.info("Invalid cookie, no persistent token could be deleted", ice);
} catch (RememberMeAuthenticationException rmae) {
log.debug("No persistent token found, so no token could be deleted", rmae);
log.debug("No persistent token found, so no token could be deleted");
}
}
super.logout(request, response, authentication);
Expand Down
13 changes: 6 additions & 7 deletions src/main/java/io/github/jhipster/sample/service/MailService.java
Expand Up @@ -14,7 +14,6 @@
import org.thymeleaf.context.Context;
import org.thymeleaf.spring4.SpringTemplateEngine;


import javax.inject.Inject;
import javax.mail.internet.MimeMessage;
import java.util.Locale;
Expand Down Expand Up @@ -67,36 +66,36 @@ public void sendEmail(String to, String subject, String content, boolean isMulti
}

@Async
public void sendActivationEmail(User user, String baseUrl) {
public void sendActivationEmail(User user) {
log.debug("Sending activation e-mail to '{}'", user.getEmail());
Locale locale = Locale.forLanguageTag(user.getLangKey());
Context context = new Context(locale);
context.setVariable(USER, user);
context.setVariable(BASE_URL, baseUrl);
context.setVariable(BASE_URL, jHipsterProperties.getMail().getBaseUrl());
String content = templateEngine.process("activationEmail", context);
String subject = messageSource.getMessage("email.activation.title", null, locale);
sendEmail(user.getEmail(), subject, content, false, true);
}

@Async
public void sendCreationEmail(User user, String baseUrl) {
public void sendCreationEmail(User user) {
log.debug("Sending creation e-mail to '{}'", user.getEmail());
Locale locale = Locale.forLanguageTag(user.getLangKey());
Context context = new Context(locale);
context.setVariable(USER, user);
context.setVariable(BASE_URL, baseUrl);
context.setVariable(BASE_URL, jHipsterProperties.getMail().getBaseUrl());
String content = templateEngine.process("creationEmail", context);
String subject = messageSource.getMessage("email.activation.title", null, locale);
sendEmail(user.getEmail(), subject, content, false, true);
}

@Async
public void sendPasswordResetMail(User user, String baseUrl) {
public void sendPasswordResetMail(User user) {
log.debug("Sending password reset e-mail to '{}'", user.getEmail());
Locale locale = Locale.forLanguageTag(user.getLangKey());
Context context = new Context(locale);
context.setVariable(USER, user);
context.setVariable(BASE_URL, baseUrl);
context.setVariable(BASE_URL, jHipsterProperties.getMail().getBaseUrl());
String content = templateEngine.process("passwordResetEmail", context);
String subject = messageSource.getMessage("email.reset.title", null, locale);
sendEmail(user.getEmail(), subject, content, false, true);
Expand Down
Expand Up @@ -2,7 +2,6 @@

import com.codahale.metrics.annotation.Timed;

import io.github.jhipster.sample.config.JHipsterProperties;
import io.github.jhipster.sample.domain.PersistentToken;
import io.github.jhipster.sample.domain.User;
import io.github.jhipster.sample.repository.PersistentTokenRepository;
Expand Down Expand Up @@ -40,9 +39,6 @@ public class AccountResource {

private final Logger log = LoggerFactory.getLogger(AccountResource.class);

@Inject
private JHipsterProperties jHipsterProperties;

@Inject
private UserRepository userRepository;

Expand All @@ -59,13 +55,12 @@ public class AccountResource {
* POST /register : register the user.
*
* @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
*/
@PostMapping(path = "/register",
produces={MediaType.APPLICATION_JSON_VALUE, MediaType.TEXT_PLAIN_VALUE})
@Timed
public ResponseEntity<?> registerAccount(@Valid @RequestBody ManagedUserVM managedUserVM, HttpServletRequest request) {
public ResponseEntity<?> registerAccount(@Valid @RequestBody ManagedUserVM managedUserVM) {

HttpHeaders textPlainHeaders = new HttpHeaders();
textPlainHeaders.setContentType(MediaType.TEXT_PLAIN);
Expand All @@ -80,18 +75,7 @@ public ResponseEntity<?> registerAccount(@Valid @RequestBody ManagedUserVM manag
managedUserVM.getFirstName(), managedUserVM.getLastName(),
managedUserVM.getEmail().toLowerCase(), managedUserVM.getLangKey());


String baseUrl = jHipsterProperties.getMail().getBaseUrl();
if (baseUrl.equals("")) {
baseUrl = request.getScheme() + // "http"
"://" + // "://"
request.getServerName() + // "myhost"
":" + // ":"
request.getServerPort() + // "80"
request.getContextPath(); // "/myContextPath" or "" if deployed in root context
}

mailService.sendActivationEmail(user, baseUrl);
mailService.sendActivationEmail(user);
return new ResponseEntity<>(HttpStatus.CREATED);
})
);
Expand Down Expand Up @@ -224,22 +208,15 @@ public void invalidateSession(@PathVariable String series) throws UnsupportedEnc
* POST /account/reset_password/init : Send an e-mail to reset the password of the user
*
* @param mail the mail of the user
* @param request the HTTP request
* @return the ResponseEntity with status 200 (OK) if the e-mail was sent, or status 400 (Bad Request) if the e-mail address is not registered
*/
@PostMapping(path = "/account/reset_password/init",
produces = MediaType.TEXT_PLAIN_VALUE)
@Timed
public ResponseEntity<?> requestPasswordReset(@RequestBody String mail, HttpServletRequest request) {
public ResponseEntity<?> requestPasswordReset(@RequestBody String mail) {
return userService.requestPasswordReset(mail)
.map(user -> {
String baseUrl = request.getScheme() +
"://" +
request.getServerName() +
":" +
request.getServerPort() +
request.getContextPath();
mailService.sendPasswordResetMail(user, baseUrl);
mailService.sendPasswordResetMail(user);
return new ResponseEntity<>("e-mail was sent", HttpStatus.OK);
}).orElse(new ResponseEntity<>("e-mail address not registered", HttpStatus.BAD_REQUEST));
}
Expand Down
Expand Up @@ -20,7 +20,7 @@
* REST controller for getting the audit events.
*/
@RestController
@RequestMapping("/management/jhipster/audits")
@RequestMapping("/management/audits")
public class AuditResource {

private AuditEventService auditEventService;
Expand All @@ -40,7 +40,7 @@ public AuditResource(AuditEventService auditEventService) {
@GetMapping
public ResponseEntity<List<AuditEvent>> getAll(Pageable pageable) throws URISyntaxException {
Page<AuditEvent> page = auditEventService.findAll(pageable);
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/audits");
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/management/audits");
return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
}

Expand All @@ -61,7 +61,7 @@ public ResponseEntity<List<AuditEvent>> getByDates(
Pageable pageable) throws URISyntaxException {

Page<AuditEvent> page = auditEventService.findByDates(fromDate.atTime(0, 0), toDate.atTime(23, 59), pageable);
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/audits");
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/management/audits");
return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
}

Expand Down
Expand Up @@ -16,7 +16,7 @@
* Controller for view and managing Log Level at runtime.
*/
@RestController
@RequestMapping("/management/jhipster")
@RequestMapping("/management")
public class LogsResource {

@GetMapping("/logs")
Expand Down
Expand Up @@ -10,23 +10,26 @@
import java.util.Arrays;
import java.util.List;

/**
* Resource to return information about the currently running Spring profiles.
*/
@RestController
@RequestMapping("/api")
public class ProfileInfoResource {

@Inject
Environment env;
private Environment env;

@Inject
private JHipsterProperties jHipsterProperties;

@GetMapping("/profile-info")
public ProfileInfoResponse getActiveProfiles() {
return new ProfileInfoResponse(DefaultProfileUtil.getActiveProfiles(env), getRibbonEnv());
String[] activeProfiles = DefaultProfileUtil.getActiveProfiles(env);
return new ProfileInfoResponse(activeProfiles, getRibbonEnv(activeProfiles));
}

private String getRibbonEnv() {
String[] activeProfiles = DefaultProfileUtil.getActiveProfiles(env);
private String getRibbonEnv(String[] activeProfiles) {
String[] displayOnActiveProfiles = jHipsterProperties.getRibbon().getDisplayOnActiveProfiles();

if (displayOnActiveProfiles == null) {
Expand Down
Expand Up @@ -75,14 +75,13 @@ public class UserResource {
* </p>
*
* @param managedUserVM the user to create
* @param request the HTTP request
* @return the ResponseEntity with status 201 (Created) and with body the new user, or with status 400 (Bad Request) if the login or email is already in use
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/users")
@Timed
@Secured(AuthoritiesConstants.ADMIN)
public ResponseEntity<?> createUser(@RequestBody ManagedUserVM managedUserVM, HttpServletRequest request) throws URISyntaxException {
public ResponseEntity<?> createUser(@RequestBody ManagedUserVM managedUserVM) throws URISyntaxException {
log.debug("REST request to save User : {}", managedUserVM);

//Lowercase the user login before comparing with database
Expand All @@ -96,13 +95,7 @@ public ResponseEntity<?> createUser(@RequestBody ManagedUserVM managedUserVM, Ht
.body(null);
} else {
User newUser = userService.createUser(managedUserVM);
String baseUrl = request.getScheme() + // "http"
"://" + // "://"
request.getServerName() + // "myhost"
":" + // ":"
request.getServerPort() + // "80"
request.getContextPath(); // "/myContextPath" or "" if deployed in root context
mailService.sendCreationEmail(newUser, baseUrl);
mailService.sendCreationEmail(newUser);
return ResponseEntity.created(new URI("/api/users/" + newUser.getLogin()))
.headers(HeaderUtil.createAlert( "userManagement.created", newUser.getLogin()))
.body(newUser);
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/config/application-dev.yml
Expand Up @@ -70,7 +70,7 @@ jhipster:
key: 5c37379956bd1242f5636c8cb322c2966ad81277
mail: # specific JHipster mail property, for standard properties see MailProperties
from: jhipsterSampleApplication@localhost
baseUrl: # keep empty to use the server's default URL
baseUrl: http://127.0.0.1:8080
metrics: # DropWizard Metrics configuration, used by MetricsConfiguration
jmx.enabled: true
graphite:
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/config/application-prod.yml
Expand Up @@ -73,7 +73,7 @@ jhipster:
key: 5c37379956bd1242f5636c8cb322c2966ad81277
mail: # specific JHipster mail property, for standard properties see MailProperties
from: jhipsterSampleApplication@localhost
baseUrl: # keep empty to use the server's default URL
baseUrl: http://my-server-url-to-change # Modify according to your server's URL
metrics: # DropWizard Metrics configuration, used by MetricsConfiguration
jmx.enabled: true
graphite:
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/config/application.yml
Expand Up @@ -20,7 +20,7 @@ spring:
application:
name: jhipsterSampleApplication
profiles:
# The commented value for `active` can be replaced with valid spring profiles to load.
# The commented value for `active` can be replaced with valid Spring profiles to load.
# Otherwise, it will be filled in by maven when building the WAR file
# Either way, it can be overridden by `--spring.profiles.active` value passed in the commandline or `-Dspring.profiles.active` set in `JAVA_OPTS`
active: #spring.profiles.active#
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/app/admin/audits/audits.service.js
Expand Up @@ -8,7 +8,7 @@
AuditsService.$inject = ['$resource'];

function AuditsService ($resource) {
var service = $resource('management/jhipster/audits/:id', {}, {
var service = $resource('management/audits/:id', {}, {
'get': {
method: 'GET',
isArray: true
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/app/admin/logs/logs.service.js
Expand Up @@ -8,7 +8,7 @@
LogsService.$inject = ['$resource'];

function LogsService ($resource) {
var service = $resource('management/jhipster/logs', {}, {
var service = $resource('management/logs', {}, {
'findAll': { method: 'GET', isArray: true},
'changeLevel': { method: 'PUT'}
});
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/app/admin/metrics/metrics.service.js
Expand Up @@ -16,7 +16,7 @@
return service;

function getMetrics () {
return $http.get('management/jhipster/metrics').then(function (response) {
return $http.get('management/metrics').then(function (response) {
return response.data;
});
}
Expand Down

0 comments on commit 40e38a8

Please sign in to comment.