diff --git a/.gitignore b/.gitignore
index b00af803d..2a98a2124 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,4 @@ target/*
*.iml
/target
_site/
+.vagrant/
diff --git a/.travis.yml b/.travis.yml
index c0f28cfa4..4c3a94df4 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,2 +1,2 @@
-language: java
-jdk: oraclejdk8
+language: java
+jdk: oraclejdk8
\ No newline at end of file
diff --git a/Jenkinsfile b/Jenkinsfile
new file mode 100644
index 000000000..ecdce01b0
--- /dev/null
+++ b/Jenkinsfile
@@ -0,0 +1,37 @@
+pipeline {
+ tools {
+ maven 'Maven 3.5.0'
+ }
+
+ agent any
+
+ stages {
+ stage('Build, Test, and Package') {
+ steps {
+ sh "mvn clean package"
+ }
+ }
+
+ stage('SonarQube Analysis') {
+ steps {
+ startSonarQubeAnalysis "SonarQube_Scanner_3.0.3.778", "Staging", "${env.WORKSPACE}", "sonar-project.properties"
+ }
+ }
+
+ stage('SonarQube Quality Gate') {
+ // we don't want to tie up an agent for this
+ agent none
+
+ steps {
+ waitForSonarQubeAnalysis 60, ['OK','WARN']
+ }
+ }
+
+ stage('Approve for QA') {
+ steps {
+ // input 'Sally forth?'
+ echo 'Pipeline done'
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Vagrantfile b/Vagrantfile
new file mode 100644
index 000000000..08db68b26
--- /dev/null
+++ b/Vagrantfile
@@ -0,0 +1,75 @@
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
+
+# All Vagrant configuration is done below. The "2" in Vagrant.configure
+# configures the configuration version (we support older styles for
+# backwards compatibility). Please don't change it unless you know what
+# you're doing.
+Vagrant.configure("2") do |config|
+ # The most common configuration options are documented and commented below.
+ # For a complete reference, please see the online documentation at
+ # https://docs.vagrantup.com.
+
+ # Every Vagrant development environment requires a box. You can search for
+ # boxes at https://atlas.hashicorp.com/search.
+ config.vm.box = "centos/7"
+
+ # Disable automatic box update checking. If you disable this, then
+ # boxes will only be checked for updates when the user runs
+ # `vagrant box outdated`. This is not recommended.
+ # config.vm.box_check_update = false
+
+ # Create a forwarded port mapping which allows access to a specific port
+ # within the machine from a port on the host machine. In the example below,
+ # accessing "localhost:8080" will access port 80 on the guest machine.
+ config.vm.network "forwarded_port", guest: 8080, host: 8484
+
+ # Create a private network, which allows host-only access to the machine
+ # using a specific IP.
+ # config.vm.network "private_network", ip: "192.168.33.10"
+
+ # Create a public network, which generally matched to bridged network.
+ # Bridged networks make the machine appear as another physical device on
+ # your network.
+ # config.vm.network "public_network"
+
+ # Share an additional folder to the guest VM. The first argument is
+ # the path on the host to the actual folder. The second argument is
+ # the path on the guest to mount the folder. And the optional third
+ # argument is a set of non-required options.
+ # config.vm.synced_folder "../data", "/vagrant_data"
+ config.vm.synced_folder ".", "/vagrant", disabled: true
+ config.vm.provision :shell, path: "bootstrap.sh"
+ config.vm.provision :file, source: "target/spring-petclinic-1.4.2.jar", destination: "/tmp/spring-petclinic-1.4.2.jar", run: "always"
+ config.vm.provision :shell, inline: "java -jar /tmp/spring-petclinic-1.4.2.jar &", run: "always"
+
+ # Provider-specific configuration so you can fine-tune various
+ # backing providers for Vagrant. These expose provider-specific options.
+ # Example for VirtualBox:
+ #
+ # config.vm.provider "virtualbox" do |vb|
+ # # Display the VirtualBox GUI when booting the machine
+ # vb.gui = true
+ #
+ # # Customize the amount of memory on the VM:
+ # vb.memory = "1024"
+ # end
+ #
+ # View the documentation for the provider you are using for more
+ # information on available options.
+
+ # Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
+ # such as FTP and Heroku are also available. See the documentation at
+ # https://docs.vagrantup.com/v2/push/atlas.html for more information.
+ # config.push.define "atlas" do |push|
+ # push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
+ # end
+
+ # Enable provisioning with a shell script. Additional provisioners such as
+ # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
+ # documentation for more information about their specific syntax and use.
+ # config.vm.provision "shell", inline: <<-SHELL
+ # apt-get update
+ # apt-get install -y apache2
+ # SHELL
+end
diff --git a/bootstrap.sh b/bootstrap.sh
new file mode 100644
index 000000000..ff9a255fc
--- /dev/null
+++ b/bootstrap.sh
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+
+# update all existing packages
+sudo yum -y update
+
+# install wget and dos2unix
+sudo yum -y install wget
+sudo yum -y install dos2unix
+
+# download java
+sudo wget --no-cookies \
+--no-check-certificate \
+--header "Cookie: oraclelicense=accept-securebackup-cookie" \
+"http://download.oracle.com/otn-pub/java/jdk/8u121-b13/e9e7ea248e2c4826b92b3f075a80e441/jdk-8u121-linux-x64.rpm" \
+-O /tmp/jdk-8-linux-x64.rpm
+
+# install java
+sudo yum -y install /tmp/jdk-8-linux-x64.rpm
+sudo rm /tmp/jdk-8-linux-x64.rpm
+
+# run the application
+#java -jar /tmp/spring-petclinic-1.4.2.jar &
\ No newline at end of file
diff --git a/buildspec.yml b/buildspec.yml
new file mode 100644
index 000000000..8fe30669a
--- /dev/null
+++ b/buildspec.yml
@@ -0,0 +1,28 @@
+version: 0.2
+
+#env:
+# variables:
+# key: "value"
+# key: "value"
+
+phases:
+# install:
+# commands:
+# - command
+# - command
+# pre_build:
+# commands:
+# - command
+# - command
+ build:
+ commands:
+ - mvn clean package
+# post_build:
+# commands:
+# - command
+# - command
+artifacts:
+ files:
+ - target/spring-petclinic-1.4.2.jar
+ discard-paths: yes
+# base-directory: location
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index fa5e4df94..46520d942 100644
--- a/pom.xml
+++ b/pom.xml
@@ -12,10 +12,8 @@
spring-boot-starter-parent
2.0.0.BUILD-SNAPSHOT
- petclinic
-
1.8
UTF-8
@@ -30,7 +28,33 @@
2.7
+
+
+
+
+ scm:git:https://github.com/Blackhound/spring-petclinic
+ scm:git:https://github.com/Blackhound/spring-petclinic
+ https://localhost:8080
+
+
@@ -108,10 +132,30 @@
spring-boot-devtools
runtime
+
+
+ org.spockframework
+ spock-core
+ 1.1-groovy-2.4-rc-3
+ test
+
+
+
+ org.codehaus.groovy
+ groovy-all
+ 2.4.7
+ test
+
+
+ org.apache.maven.plugins
+ maven-scm-plugin
+ 1.9.5
+
+
org.springframework.boot
spring-boot-maven-plugin
@@ -133,25 +177,18 @@
+
- org.codehaus.mojo
- cobertura-maven-plugin
- ${cobertura.version}
+ org.apache.maven.plugins
+ maven-surefire-plugin
-
+ random
-
-
-
- clean
- check
-
-
-
-
+
+
ro.isdc.wro4j
@@ -199,24 +237,15 @@
-
-
-
-
-
-
- org.codehaus.mojo
- cobertura-maven-plugin
- ${cobertura.version}
+
+
+ org.apache.maven.plugins
+ maven-deploy-plugin
+ 2.8.2
-
- html
-
-
+ false
-
-
@@ -225,5 +254,4 @@
http://www.apache.org/licenses/LICENSE-2.0
-
diff --git a/readme.md b/readme.md
index 3f4c376ec..a7d188867 100644
--- a/readme.md
+++ b/readme.md
@@ -15,6 +15,7 @@ You can then access petclinic here: http://localhost:8080/
## In case you find a bug/suggested improvement for Spring Petclinic
+## Minor change - Ray
Our issue tracker is available here: https://github.com/spring-projects/spring-petclinic/issues
@@ -104,8 +105,6 @@ The [issue tracker](https://github.com/spring-projects/spring-petclinic/issues)
For pull requests, editor preferences are available in the [editor config](.editorconfig) for easy use in common text editors. Read more and download plugins at . If you have not previously done so, please fill out and submit the https://cla.pivotal.io/sign/spring[Contributor License Agreement].
-# License
-
The Spring PetClinic sample application is released under version 2.0 of the [Apache License](http://www.apache.org/licenses/LICENSE-2.0).
[spring-petclinic]: https://github.com/spring-projects/spring-petclinic
diff --git a/sonar-project.properties b/sonar-project.properties
old mode 100755
new mode 100644
index d84ed7c2d..1357f9b54
--- a/sonar-project.properties
+++ b/sonar-project.properties
@@ -1,13 +1,19 @@
# Required metadata
-sonar.projectKey=java-sonar-runner-simple
-sonar.projectName=Simple Java project analyzed with the SonarQube Runner
-sonar.projectVersion=1.0
+sonar.projectKey=org.springframework.samples:spring-petclinic
+sonar.projectName=Spring Pet Clinic
+sonar.projectVersion=1.4.2
# Comma-separated paths to directories with sources (required)
-sonar.sources=src
+#sonar.sources=src/main/java,src/main/less,src/main/resources,src/main/wro
+sonar.sources=src/main
# Language
-sonar.language=java
+#sonar.language=java
# Encoding of the source files
-sonar.sourceEncoding=UTF-8
\ No newline at end of file
+sonar.sourceEncoding=UTF-8
+
+# other stuff
+sonar.host.url=http://mssonarstg81.morningstar.com:9000
+sonar.java.binaries=target/classes
+sonar.junit.reportsPath=target/surefire-reports
\ No newline at end of file
diff --git a/src/main/java/org/springframework/samples/petclinic/system/CacheConfig.java b/src/main/java/org/springframework/samples/petclinic/system/CacheConfig.java
index 13e194c35..7d2128e2f 100755
--- a/src/main/java/org/springframework/samples/petclinic/system/CacheConfig.java
+++ b/src/main/java/org/springframework/samples/petclinic/system/CacheConfig.java
@@ -6,6 +6,7 @@ import javax.cache.configuration.MutableConfiguration;
import org.springframework.boot.autoconfigure.cache.JCacheManagerCustomizer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
+
import org.springframework.context.annotation.Profile;
/**
@@ -16,6 +17,7 @@ import org.springframework.context.annotation.Profile;
@Profile("production")
class CacheConfig {
+
@Bean
public JCacheManagerCustomizer cacheManagerCustomizer() {
return cm -> {
diff --git a/src/main/java/org/springframework/samples/petclinic/vet/VetRepository.java b/src/main/java/org/springframework/samples/petclinic/vet/VetRepository.java
index 20863ce76..4451f717c 100644
--- a/src/main/java/org/springframework/samples/petclinic/vet/VetRepository.java
+++ b/src/main/java/org/springframework/samples/petclinic/vet/VetRepository.java
@@ -17,7 +17,8 @@ package org.springframework.samples.petclinic.vet;
import java.util.Collection;
-import org.springframework.cache.annotation.Cacheable;
+import javax.cache.annotation.CacheResult;
+
import org.springframework.dao.DataAccessException;
import org.springframework.data.repository.Repository;
import org.springframework.transaction.annotation.Transactional;
@@ -39,8 +40,7 @@ public interface VetRepository extends Repository {
* @return a Collection
of Vet
s
*/
@Transactional(readOnly = true)
- @Cacheable("vets")
+ @CacheResult(cacheName = "vets")
Collection findAll() throws DataAccessException;
-
-}
+}
\ No newline at end of file
diff --git a/src/test/groovy/org/springframework/samples/petclinic/model/ValidatorSpockTests.groovy b/src/test/groovy/org/springframework/samples/petclinic/model/ValidatorSpockTests.groovy
new file mode 100644
index 000000000..d8c988716
--- /dev/null
+++ b/src/test/groovy/org/springframework/samples/petclinic/model/ValidatorSpockTests.groovy
@@ -0,0 +1,55 @@
+package org.springframework.samples.petclinic.model;
+
+//import static org.assertj.core.api.Assertions.assertThat;
+
+import java.util.Locale;
+import java.util.Set;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+
+import org.springframework.context.i18n.LocaleContextHolder;
+import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
+
+import spock.lang.Specification;
+
+/**
+ * @author Chris Jones
+ * Simple tests adapted to use the Spock acceptance test framework.
+ */
+public class ValidatorSpockTests extends Specification {
+
+ private Validator createValidator() {
+ LocalValidatorFactoryBean localValidatorFactoryBean = new LocalValidatorFactoryBean();
+ localValidatorFactoryBean.afterPropertiesSet();
+ return localValidatorFactoryBean;
+ }
+
+ // 1. validate against blank first name
+ def "first name cannot be empty"() {
+ setup:
+ def person = new Person();
+ def validator = createValidator();
+
+ when:
+ person.setFirstName("")
+ person.setLastName("smith")
+ Set> constraintViolations = validator.validate(person);
+
+ then:
+ constraintViolations.size() == 1;
+ ConstraintViolation violation = constraintViolations.iterator().next();
+ violation.getPropertyPath().toString().equals("firstName");
+ violation.getMessage().equals("may not be empty");
+ }
+
+ // 2. TODO: validate against null first name.
+
+ // 3. TODO: validate a against a valid first name (non-empty, non-null value).
+
+ // 4. TODO: validate against empty last name
+
+ // 5. TODO: validate against null last name
+
+ // 6. TODO: validate a against a valid last name (non-empty, non-null value).
+}