Skip to content
Snippets Groups Projects
Commit 4b18dc53 authored by Antoine Rey's avatar Antoine Rey
Browse files

Merge remote-tracking branch 'upstream/master' into admin

# Conflicts:
#	pom.xml
#	spring-petclinic-api-gateway/pom.xml
parents b9a803ca 6c118e49
No related branches found
No related tags found
No related merge requests found
Showing
with 245 additions and 187 deletions
var gulp = require('gulp');
var cleanCSS = require('gulp-clean-css');
var uglify = require('gulp-uglify');
var less = require('gulp-less');
var paths = {
"css" : "src/css/*",
"fonts" : "src/fonts/*",
"images" : "src/images/*",
"html" : "src/scripts/**/*.html",
"js" : "src/scripts/**/*.js",
"less" : "src/less/*",
"dist" : "target/dist/"
};
gulp.task('minify-css', function() {
return gulp.src(paths.css)
.pipe(cleanCSS())
.pipe(gulp.dest(paths.dist + 'css/'));
});
gulp.task('minify-js', function() {
return gulp.src(paths.js)
.pipe(uglify())
.pipe(gulp.dest(paths.dist + 'scripts/'));
});
gulp.task('less', function () {
return gulp.src(paths.less)
.pipe(less())
.pipe(gulp.dest(paths.dist + 'css/'));
});
gulp.task('copy-fonts', function() {
return gulp.src(paths.fonts)
.pipe(gulp.dest(paths.dist + 'fonts/'))
});
gulp.task('copy-html', function() {
return gulp.src(paths.html)
.pipe(gulp.dest(paths.dist + 'scripts/'))
});
gulp.task('copy-images', function() {
return gulp.src(paths.images)
.pipe(gulp.dest(paths.dist + 'images/'))
});
gulp.task('default', ['minify-css', 'minify-js', 'less',
'copy-fonts', 'copy-html', 'copy-images'], function() {});
{
"private": true,
"dependencies": {},
"devDependencies": {
"bower": "^1.7.9",
"gulp": "^3.9.1",
"gulp-clean-css": "^2.0.6",
"gulp-uglify": "^1.5.3",
"gulp-less": "^3.1.0"
}
}
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.samples</groupId>
<artifactId>spring-petclinic-microservices</artifactId>
<version>1.4.2</version>
</parent>
<artifactId>spring-petclinic-ui</artifactId>
<version>1.4.2</version>
<description>Front-end webjar based on Angular 1</description>
<properties>
<node.version>v4.4.3</node.version>
<npm.version>2.15.1</npm.version>
</properties>
<build>
<resources>
<resource>
<directory>${project.build.directory}/dist</directory>
</resource>
<resource>
<directory>${basedir}/bower_components</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<configuration>
<installDirectory>target</installDirectory>
</configuration>
<executions>
<execution>
<id>install node and npm</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<configuration>
<nodeVersion>${node.version}</nodeVersion>
<npmVersion>${npm.version}</npmVersion>
</configuration>
</execution>
<execution>
<id>npm install</id>
<goals>
<goal>npm</goal>
</goals>
</execution>
<execution>
<id>bower install</id>
<goals>
<goal>bower</goal>
</goals>
</execution>
<execution>
<id>gulp build</id>
<goals>
<goal>gulp</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<outputDirectory>${project.build.directory}/classes/public/</outputDirectory>
</configuration>
</plugin>
</plugins>
</build>
</project>
The src/css/petclinic.css file improves development experience.
Developers don't have to build the project and generate the target/dist/css/petclinic.css from less files.
This diff is collapsed.
This diff is collapsed.
/.apt_generated/
package org.springframework.samples.petclinic.vets.system;
import org.ehcache.config.CacheConfiguration;
import org.ehcache.config.builders.CacheConfigurationBuilder;
import org.ehcache.config.builders.ResourcePoolsBuilder;
import org.ehcache.config.units.EntryUnit;
import org.ehcache.expiry.Duration;
import org.ehcache.expiry.Expirations;
import org.ehcache.jsr107.Eh107Configuration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.cache.JCacheManagerCustomizer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.concurrent.TimeUnit;
import org.springframework.context.annotation.Profile;
/**
* Cache could be disable in unit test.
......@@ -21,22 +10,6 @@ import java.util.concurrent.TimeUnit;
*/
@Configuration
@EnableCaching
public class CacheConfig {
@Autowired
VetsProperties vetsProperties;
@Bean
public JCacheManagerCustomizer cacheManagerCustomizer() {
return cacheManager -> {
CacheConfiguration<Object, Object> config = CacheConfigurationBuilder
.newCacheConfigurationBuilder(Object.class, Object.class,
ResourcePoolsBuilder.newResourcePoolsBuilder()
.heap(vetsProperties.getCache().getHeapSize(), EntryUnit.ENTRIES))
.withExpiry(Expirations.timeToLiveExpiration(Duration.of(vetsProperties.getCache().getTtl(), TimeUnit.SECONDS)))
.build();
cacheManager.createCache("vets", Eh107Configuration.fromEhcacheCacheConfiguration(config));
};
}
@Profile("production")
class CacheConfig {
}
server.port=0
petclinic.database=hsqldb
spring.datasource.schema=classpath*:db/${petclinic.database}/schema.sql
spring.datasource.data=classpath*:db/${petclinic.database}/data.sql
logging.level.org.springframework=INFO
spring.profiles.active=production
spring.cache.cache-names=vets
\ No newline at end of file
package org.springframework.samples.petclinic.vets.web;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.samples.petclinic.vets.model.Vet;
import org.springframework.samples.petclinic.vets.model.VetRepository;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Maciej Szarlinski
*/
@RunWith(SpringRunner.class)
@DataJpaTest
@ActiveProfiles("test")
public class VetResourceDatabaseTest {
@Autowired
private VetRepository vetRepository;
@Test
public void shouldGetAListOfVetsInJSonFormat() throws Exception {
Vet vet = vetRepository.findOne(1);
assertThat(vetRepository.findAll()).contains(vet);
}
}
petclinic.database: hsqldb
spring:
datasource:
schema: classpath*:db/${petclinic.database}/schema.sql
data: classpath*:db/${petclinic.database}/data.sql
spring.jpa.hibernate.ddl-auto: none
logging.level.org.springframework: INFO
vets:
cache:
ttl: 10
......
server.port=0
petclinic.database=hsqldb
spring.datasource.schema=classpath*:db/${petclinic.database}/schema.sql
spring.datasource.data=classpath*:db/${petclinic.database}/data.sql
logging.level.org.springframework=INFO
package org.springframework.samples.petclinic.visits;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
import org.springframework.samples.petclinic.visits.model.Visit;
import org.springframework.samples.petclinic.visits.model.VisitRepository;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Maciej Szarlinski
*/
@RunWith(SpringRunner.class)
@DataJpaTest
@ActiveProfiles("test")
public class VisitResourceDatabaseTest {
@Autowired
private VisitRepository visitRepository;
@Test
public void shouldGetAListOfVetsInJSonFormat() throws Exception {
Visit vet = visitRepository.findOne(1);
assertThat(visitRepository.findAll()).contains(vet);
}
}
petclinic.database: hsqldb
spring:
datasource:
schema: classpath*:db/${petclinic.database}/schema.sql
data: classpath*:db/${petclinic.database}/data.sql
spring.jpa.hibernate.ddl-auto: none
logging.level.org.springframework: INFO
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment