fixed everything with running errors

This commit is contained in:
Sasank Vishnubhatla 2017-06-14 16:57:34 -04:00
parent a217213d5e
commit d9772eb4b4
79 changed files with 14050 additions and 14050 deletions

View file

@ -1,12 +1,12 @@
# top-most EditorConfig file # top-most EditorConfig file
root = true root = true
[*] [*]
charset = utf-8 charset = utf-8
end_of_line = lf end_of_line = lf
insert_final_newline = true insert_final_newline = true
indent_style = space indent_style = space
[*.{java,xml}] [*.{java,xml}]
indent_size = 4 indent_size = 4
trim_trailing_whitespace = true trim_trailing_whitespace = true

18
.gitignore vendored
View file

@ -1,9 +1,9 @@
target/* target/*
.settings/* .settings/*
.classpath .classpath
.project .project
.idea .idea
*.iml *.iml
/target /target
_site/ _site/
.DS_Store .DS_Store

View file

@ -1 +1 @@
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.3/apache-maven-3.3.3-bin.zip distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.3/apache-maven-3.3.3-bin.zip

View file

@ -1,20 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<beansProjectDescription> <beansProjectDescription>
<version>1</version> <version>1</version>
<pluginVersion><![CDATA[3.5.0.201404011509-RELEASE]]></pluginVersion> <pluginVersion><![CDATA[3.5.0.201404011509-RELEASE]]></pluginVersion>
<configSuffixes> <configSuffixes>
<configSuffix><![CDATA[xml]]></configSuffix> <configSuffix><![CDATA[xml]]></configSuffix>
</configSuffixes> </configSuffixes>
<enableImports><![CDATA[false]]></enableImports> <enableImports><![CDATA[false]]></enableImports>
<configs> <configs>
<config>src/main/resources/spring/datasource-config.xml</config> <config>src/main/resources/spring/datasource-config.xml</config>
<config>src/main/resources/spring/mvc-core-config.xml</config> <config>src/main/resources/spring/mvc-core-config.xml</config>
<config>src/main/resources/spring/mvc-view-config.xml</config> <config>src/main/resources/spring/mvc-view-config.xml</config>
<config>src/main/resources/spring/business-config.xml</config> <config>src/main/resources/spring/business-config.xml</config>
</configs> </configs>
<autoconfigs> <autoconfigs>
<config>src/main/resources/spring/tools-config.xml</config> <config>src/main/resources/spring/tools-config.xml</config>
</autoconfigs> </autoconfigs>
<configSets> <configSets>
</configSets> </configSets>
</beansProjectDescription> </beansProjectDescription>

View file

@ -1,2 +1,2 @@
language: java language: java
jdk: oraclejdk8 jdk: oraclejdk8

View file

@ -1,9 +1,9 @@
mysql: mysql:
image: mysql image: mysql
ports: ports:
- "3306:3306" - "3306:3306"
environment: environment:
- MYSQL_ROOT_PASSWORD=root - MYSQL_ROOT_PASSWORD=root
- MYSQL_DATABASE=test - MYSQL_DATABASE=test
volumes: volumes:
- "./conf.d:/etc/mysql/conf.d:ro" - "./conf.d:/etc/mysql/conf.d:ro"

458
pom.xml
View file

@ -1,229 +1,229 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.samples</groupId> <groupId>org.springframework.samples</groupId>
<artifactId>spring-petclinic</artifactId> <artifactId>spring-petclinic</artifactId>
<version>1.5.1</version> <version>1.5.1</version>
<parent> <parent>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId> <artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.1.RELEASE</version> <version>1.5.1.RELEASE</version>
</parent> </parent>
<name>petclinic</name> <name>petclinic</name>
<properties> <properties>
<!-- Generic properties --> <!-- Generic properties -->
<java.version>1.8</java.version> <java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<!-- Web dependencies --> <!-- Web dependencies -->
<webjars-bootstrap.version>3.3.6</webjars-bootstrap.version> <webjars-bootstrap.version>3.3.6</webjars-bootstrap.version>
<webjars-jquery-ui.version>1.11.4</webjars-jquery-ui.version> <webjars-jquery-ui.version>1.11.4</webjars-jquery-ui.version>
<webjars-jquery.version>2.2.4</webjars-jquery.version> <webjars-jquery.version>2.2.4</webjars-jquery.version>
<wro4j.version>1.8.0</wro4j.version> <wro4j.version>1.8.0</wro4j.version>
<thymeleaf.version>3.0.2.RELEASE</thymeleaf.version> <thymeleaf.version>3.0.2.RELEASE</thymeleaf.version>
<cobertura.version>2.7</cobertura.version> <cobertura.version>2.7</cobertura.version>
</properties> </properties>
<dependencies> <dependencies>
<!-- Spring and Spring Boot dependencies --> <!-- Spring and Spring Boot dependencies -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId> <artifactId>spring-boot-starter-actuator</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId> <artifactId>spring-boot-starter-cache</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId> <artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId> <artifactId>spring-boot-starter-web</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId> <artifactId>spring-boot-starter-thymeleaf</artifactId>
<exclusions> <exclusions>
<exclusion> <exclusion>
<groupId>nz.net.ultraq.thymeleaf</groupId> <groupId>nz.net.ultraq.thymeleaf</groupId>
<artifactId>thymeleaf-layout-dialect</artifactId> <artifactId>thymeleaf-layout-dialect</artifactId>
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<!-- Databases - Uses HSQL by default --> <!-- Databases - Uses HSQL by default -->
<dependency> <dependency>
<groupId>org.hsqldb</groupId> <groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId> <artifactId>hsqldb</artifactId>
<scope>runtime</scope> <scope>runtime</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>mysql</groupId> <groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId> <artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope> <scope>runtime</scope>
</dependency> </dependency>
<!-- caching --> <!-- caching -->
<dependency> <dependency>
<groupId>javax.cache</groupId> <groupId>javax.cache</groupId>
<artifactId>cache-api</artifactId> <artifactId>cache-api</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.ehcache</groupId> <groupId>org.ehcache</groupId>
<artifactId>ehcache</artifactId> <artifactId>ehcache</artifactId>
</dependency> </dependency>
<!-- webjars --> <!-- webjars -->
<dependency> <dependency>
<groupId>org.webjars</groupId> <groupId>org.webjars</groupId>
<artifactId>webjars-locator</artifactId> <artifactId>webjars-locator</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.webjars</groupId> <groupId>org.webjars</groupId>
<artifactId>jquery</artifactId> <artifactId>jquery</artifactId>
<version>${webjars-jquery.version}</version> <version>${webjars-jquery.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.webjars</groupId> <groupId>org.webjars</groupId>
<artifactId>jquery-ui</artifactId> <artifactId>jquery-ui</artifactId>
<version>${webjars-jquery-ui.version}</version> <version>${webjars-jquery-ui.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.webjars</groupId> <groupId>org.webjars</groupId>
<artifactId>bootstrap</artifactId> <artifactId>bootstrap</artifactId>
<version>${webjars-bootstrap.version}</version> <version>${webjars-bootstrap.version}</version>
</dependency> </dependency>
<!-- end of webjars --> <!-- end of webjars -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId> <artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope> <scope>runtime</scope>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
<executions> <executions>
<execution> <execution>
<!-- Spring Boot Actuator displays build-related information <!-- Spring Boot Actuator displays build-related information
if a META-INF/build-info.properties file is present --> if a META-INF/build-info.properties file is present -->
<goals> <goals>
<goal>build-info</goal> <goal>build-info</goal>
</goals> </goals>
<configuration> <configuration>
<additionalProperties> <additionalProperties>
<encoding.source>${project.build.sourceEncoding}</encoding.source> <encoding.source>${project.build.sourceEncoding}</encoding.source>
<encoding.reporting>${project.reporting.outputEncoding}</encoding.reporting> <encoding.reporting>${project.reporting.outputEncoding}</encoding.reporting>
<java.source>${maven.compiler.source}</java.source> <java.source>${maven.compiler.source}</java.source>
<java.target>${maven.compiler.target}</java.target> <java.target>${maven.compiler.target}</java.target>
</additionalProperties> </additionalProperties>
</configuration> </configuration>
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.codehaus.mojo</groupId> <groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId> <artifactId>cobertura-maven-plugin</artifactId>
<version>${cobertura.version}</version> <version>${cobertura.version}</version>
<configuration> <configuration>
<check /> <check />
</configuration> </configuration>
<executions> <executions>
<execution> <execution>
<goals> <goals>
<goal>clean</goal> <goal>clean</goal>
<goal>check</goal> <goal>check</goal>
</goals> </goals>
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<!-- Spring Boot Actuator displays build-related information if a git.properties <!-- Spring Boot Actuator displays build-related information if a git.properties
file is present at the classpath --> file is present at the classpath -->
<plugin> <plugin>
<groupId>pl.project13.maven</groupId> <groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId> <artifactId>git-commit-id-plugin</artifactId>
<executions> <executions>
<execution> <execution>
<goals> <goals>
<goal>revision</goal> <goal>revision</goal>
</goals> </goals>
</execution> </execution>
</executions> </executions>
<configuration> <configuration>
<verbose>true</verbose> <verbose>true</verbose>
<dateFormat>yyyy-MM-dd'T'HH:mm:ssZ</dateFormat> <dateFormat>yyyy-MM-dd'T'HH:mm:ssZ</dateFormat>
<generateGitPropertiesFile>true</generateGitPropertiesFile> <generateGitPropertiesFile>true</generateGitPropertiesFile>
<generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties <generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties
</generateGitPropertiesFilename> </generateGitPropertiesFilename>
<failOnNoGitDirectory>false</failOnNoGitDirectory> <failOnNoGitDirectory>false</failOnNoGitDirectory>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>ro.isdc.wro4j</groupId> <groupId>ro.isdc.wro4j</groupId>
<artifactId>wro4j-maven-plugin</artifactId> <artifactId>wro4j-maven-plugin</artifactId>
<version>${wro4j.version}</version> <version>${wro4j.version}</version>
<executions> <executions>
<execution> <execution>
<phase>generate-resources</phase> <phase>generate-resources</phase>
<goals> <goals>
<goal>run</goal> <goal>run</goal>
</goals> </goals>
</execution> </execution>
</executions> </executions>
<configuration> <configuration>
<wroManagerFactory>ro.isdc.wro.maven.plugin.manager.factory.ConfigurableWroManagerFactory</wroManagerFactory> <wroManagerFactory>ro.isdc.wro.maven.plugin.manager.factory.ConfigurableWroManagerFactory</wroManagerFactory>
<cssDestinationFolder>${project.build.directory}/classes/static/resources/css</cssDestinationFolder> <cssDestinationFolder>${project.build.directory}/classes/static/resources/css</cssDestinationFolder>
<wroFile>${basedir}/src/main/wro/wro.xml</wroFile> <wroFile>${basedir}/src/main/wro/wro.xml</wroFile>
<extraConfigFile>${basedir}/src/main/wro/wro.properties</extraConfigFile> <extraConfigFile>${basedir}/src/main/wro/wro.properties</extraConfigFile>
<contextFolder>${basedir}/src/main/less</contextFolder> <contextFolder>${basedir}/src/main/less</contextFolder>
</configuration> </configuration>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.webjars</groupId> <groupId>org.webjars</groupId>
<artifactId>bootstrap</artifactId> <artifactId>bootstrap</artifactId>
<version>${webjars-bootstrap.version}</version> <version>${webjars-bootstrap.version}</version>
</dependency> </dependency>
</dependencies> </dependencies>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
<reporting> <reporting>
<plugins> <plugins>
<!-- integrate maven-cobertura-plugin to project site --> <!-- integrate maven-cobertura-plugin to project site -->
<plugin> <plugin>
<groupId>org.codehaus.mojo</groupId> <groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId> <artifactId>cobertura-maven-plugin</artifactId>
<version>${cobertura.version}</version> <version>${cobertura.version}</version>
<configuration> <configuration>
<formats> <formats>
<format>html</format> <format>html</format>
</formats> </formats>
<check /> <check />
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>
</reporting> </reporting>
</project> </project>

View file

@ -1,9 +1,9 @@
# Spring KidClinic Sample Application # Spring KidClinic Sample Application
## Running kidclinic locally ## Running kidclinic locally
``` ```
cd kidclinic cd kidclinic
./mvnw spring-boot:run ./mvnw spring-boot:run
``` ```
You can then access kidclinic here: http://localhost:8080/ You can then access kidclinic here: http://localhost:8080/

View file

@ -1,13 +1,13 @@
# Required metadata # Required metadata
sonar.projectKey=java-sonar-runner-simple sonar.projectKey=java-sonar-runner-simple
sonar.projectName=Simple Java project analyzed with the SonarQube Runner sonar.projectName=Simple Java project analyzed with the SonarQube Runner
sonar.projectVersion=1.0 sonar.projectVersion=1.0
# Comma-separated paths to directories with sources (required) # Comma-separated paths to directories with sources (required)
sonar.sources=src sonar.sources=src
# Language # Language
sonar.language=java sonar.language=java
# Encoding of the source files # Encoding of the source files
sonar.sourceEncoding=UTF-8 sonar.sourceEncoding=UTF-8

View file

@ -1,35 +1,35 @@
/* /*
* Copyright 2002-2014 the original author or authors. * Copyright 2002-2014 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.samples.kidclinic; package org.springframework.samples.kidclinic;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
/** /**
* KidClinic Spring Boot Application. * KidClinic Spring Boot Application.
* *
* @author Dave Syer * @author Dave Syer
* *
*/ */
@SpringBootApplication @SpringBootApplication
public class KidClinicApplication { public class KidClinicApplication {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
SpringApplication.run(KidClinicApplication.class, args); SpringApplication.run(KidClinicApplication.class, args);
} }
} }

View file

@ -1,79 +1,79 @@
/* /*
* Copyright 2002-2013 the original author or authors. * Copyright 2002-2013 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.samples.kidclinic.doctor; package org.springframework.samples.kidclinic.doctor;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.FetchType; import javax.persistence.FetchType;
import javax.persistence.JoinColumn; import javax.persistence.JoinColumn;
import javax.persistence.JoinTable; import javax.persistence.JoinTable;
import javax.persistence.ManyToMany; import javax.persistence.ManyToMany;
import javax.persistence.Table; import javax.persistence.Table;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import org.springframework.beans.support.MutableSortDefinition; import org.springframework.beans.support.MutableSortDefinition;
import org.springframework.beans.support.PropertyComparator; import org.springframework.beans.support.PropertyComparator;
import org.springframework.samples.kidclinic.model.Person; import org.springframework.samples.kidclinic.model.Person;
/** /**
* Simple JavaBean domain object representing a veterinarian. * Simple JavaBean domain object representing a veterinarian.
* *
* @author Ken Krebs * @author Ken Krebs
* @author Juergen Hoeller * @author Juergen Hoeller
* @author Sam Brannen * @author Sam Brannen
* @author Arjen Poutsma * @author Arjen Poutsma
*/ */
@Entity @Entity
@Table(name = "doctors") @Table(name = "doctors")
public class Doctor extends Person { public class Doctor extends Person {
@ManyToMany(fetch = FetchType.EAGER) @ManyToMany(fetch = FetchType.EAGER)
@JoinTable(name = "doctor_specialties", joinColumns = @JoinColumn(name = "doctor_id"), inverseJoinColumns = @JoinColumn(name = "specialty_id")) @JoinTable(name = "doctor_specialties", joinColumns = @JoinColumn(name = "doctor_id"), inverseJoinColumns = @JoinColumn(name = "specialty_id"))
private Set<Specialty> specialties; private Set<Specialty> specialties;
protected Set<Specialty> getSpecialtiesInternal() { protected Set<Specialty> getSpecialtiesInternal() {
if (this.specialties == null) { if (this.specialties == null) {
this.specialties = new HashSet<>(); this.specialties = new HashSet<>();
} }
return this.specialties; return this.specialties;
} }
protected void setSpecialtiesInternal(Set<Specialty> specialties) { protected void setSpecialtiesInternal(Set<Specialty> specialties) {
this.specialties = specialties; this.specialties = specialties;
} }
@XmlElement @XmlElement
public List<Specialty> getSpecialties() { public List<Specialty> getSpecialties() {
List<Specialty> sortedSpecs = new ArrayList<>(getSpecialtiesInternal()); List<Specialty> sortedSpecs = new ArrayList<>(getSpecialtiesInternal());
PropertyComparator.sort(sortedSpecs, PropertyComparator.sort(sortedSpecs,
new MutableSortDefinition("name", true, true)); new MutableSortDefinition("name", true, true));
return Collections.unmodifiableList(sortedSpecs); return Collections.unmodifiableList(sortedSpecs);
} }
public int getNrOfSpecialties() { public int getNrOfSpecialties() {
return getSpecialtiesInternal().size(); return getSpecialtiesInternal().size();
} }
public void addSpecialty(Specialty specialty) { public void addSpecialty(Specialty specialty) {
getSpecialtiesInternal().add(specialty); getSpecialtiesInternal().add(specialty);
} }
} }

View file

@ -1,60 +1,60 @@
/* /*
* Copyright 2002-2013 the original author or authors. * Copyright 2002-2013 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.samples.kidclinic.doctor; package org.springframework.samples.kidclinic.doctor;
import java.util.Map; import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
/** /**
* @author Juergen Hoeller * @author Juergen Hoeller
* @author Mark Fisher * @author Mark Fisher
* @author Ken Krebs * @author Ken Krebs
* @author Arjen Poutsma * @author Arjen Poutsma
*/ */
@Controller @Controller
class DoctorController { class DoctorController {
private final DoctorRepository doctors; private final DoctorRepository doctors;
@Autowired @Autowired
public DoctorController(DoctorRepository clinicService) { public DoctorController(DoctorRepository clinicService) {
this.doctors = clinicService; this.doctors = clinicService;
} }
@RequestMapping(value = { "/doctors.html" }) @RequestMapping(value = { "/doctors.html" })
public String showDoctorList(Map<String, Object> model) { public String showDoctorList(Map<String, Object> model) {
// Here we are returning an object of type 'Doctors' rather than a collection of Doctor // Here we are returning an object of type 'Doctors' rather than a collection of Doctor
// objects so it is simpler for Object-Xml mapping // objects so it is simpler for Object-Xml mapping
Doctors doctors = new Doctors(); Doctors doctors = new Doctors();
doctors.getDoctorList().addAll(this.doctors.findAll()); doctors.getDoctorList().addAll(this.doctors.findAll());
model.put("doctors", doctors); model.put("doctors", doctors);
return "doctors/doctorList"; return "doctors/doctorList";
} }
@RequestMapping(value = { "/doctors.json", "/doctors.xml" }) @RequestMapping(value = { "/doctors.json", "/doctors.xml" })
public @ResponseBody Doctors showResourcesVetList() { public @ResponseBody Doctors showResourcesVetList() {
// Here we are returning an object of type 'Doctors' rather than a collection of Doctor // Here we are returning an object of type 'Doctors' rather than a collection of Doctor
// objects so it is simpler for JSon/Object mapping // objects so it is simpler for JSon/Object mapping
Doctors doctors = new Doctors(); Doctors doctors = new Doctors();
doctors.getDoctorList().addAll(this.doctors.findAll()); doctors.getDoctorList().addAll(this.doctors.findAll());
return doctors; return doctors;
} }
} }

View file

@ -1,46 +1,46 @@
/* /*
* Copyright 2002-2013 the original author or authors. * Copyright 2002-2013 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.samples.kidclinic.doctor; package org.springframework.samples.kidclinic.doctor;
import java.util.Collection; import java.util.Collection;
import org.springframework.cache.annotation.Cacheable; import org.springframework.cache.annotation.Cacheable;
import org.springframework.dao.DataAccessException; import org.springframework.dao.DataAccessException;
import org.springframework.data.repository.Repository; import org.springframework.data.repository.Repository;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
/** /**
* Repository class for <code>Doctor</code> domain objects All method names are compliant with Spring Data naming * Repository class for <code>Doctor</code> domain objects All method names are compliant with Spring Data naming
* conventions so this interface can easily be extended for Spring Data See here: http://static.springsource.org/spring-data/jpa/docs/current/reference/html/jpa.repositories.html#jpa.query-methods.query-creation * conventions so this interface can easily be extended for Spring Data See here: http://static.springsource.org/spring-data/jpa/docs/current/reference/html/jpa.repositories.html#jpa.query-methods.query-creation
* *
* @author Ken Krebs * @author Ken Krebs
* @author Juergen Hoeller * @author Juergen Hoeller
* @author Sam Brannen * @author Sam Brannen
* @author Michael Isvy * @author Michael Isvy
*/ */
public interface DoctorRepository extends Repository<Doctor, Integer> { public interface DoctorRepository extends Repository<Doctor, Integer> {
/** /**
* Retrieve all <code>Doctor</code>s from the data store. * Retrieve all <code>Doctor</code>s from the data store.
* *
* @return a <code>Collection</code> of <code>Doctor</code>s * @return a <code>Collection</code> of <code>Doctor</code>s
*/ */
@Transactional(readOnly = true) @Transactional(readOnly = true)
@Cacheable("doctors") @Cacheable("doctors")
Collection<Doctor> findAll() throws DataAccessException; Collection<Doctor> findAll() throws DataAccessException;
} }

View file

@ -1,43 +1,43 @@
/* /*
* Copyright 2002-2013 the original author or authors. * Copyright 2002-2013 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.samples.kidclinic.doctor; package org.springframework.samples.kidclinic.doctor;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
/** /**
* Simple domain object representing a list of doctors. Mostly here to be used for the 'doctors' {@link * Simple domain object representing a list of doctors. Mostly here to be used for the 'doctors' {@link
* org.springframework.web.servlet.view.xml.MarshallingView}. * org.springframework.web.servlet.view.xml.MarshallingView}.
* *
* @author Arjen Poutsma * @author Arjen Poutsma
*/ */
@XmlRootElement @XmlRootElement
public class Doctors { public class Doctors {
private List<Doctor> doctors; private List<Doctor> doctors;
@XmlElement @XmlElement
public List<Doctor> getDoctorList() { public List<Doctor> getDoctorList() {
if (doctors == null) { if (doctors == null) {
doctors = new ArrayList<>(); doctors = new ArrayList<>();
} }
return doctors; return doctors;
} }
} }

View file

@ -1,34 +1,34 @@
/* /*
* Copyright 2002-2013 the original author or authors. * Copyright 2002-2013 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.samples.kidclinic.doctor; package org.springframework.samples.kidclinic.doctor;
import java.io.Serializable; import java.io.Serializable;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Table; import javax.persistence.Table;
import org.springframework.samples.kidclinic.model.NamedEntity; import org.springframework.samples.kidclinic.model.NamedEntity;
/** /**
* Models a {@link Doctor Doctor's} specialty (for example, dentistry). * Models a {@link Doctor Doctor's} specialty (for example, dentistry).
* *
* @author Juergen Hoeller * @author Juergen Hoeller
*/ */
@Entity @Entity
@Table(name = "specialties") @Table(name = "specialties")
public class Specialty extends NamedEntity implements Serializable { public class Specialty extends NamedEntity implements Serializable {
} }

View file

@ -1,50 +1,50 @@
/* /*
* Copyright 2002-2013 the original author or authors. * Copyright 2002-2013 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.samples.kidclinic.model; package org.springframework.samples.kidclinic.model;
import java.io.Serializable; import java.io.Serializable;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.MappedSuperclass; import javax.persistence.MappedSuperclass;
/** /**
* Simple JavaBean domain object with an id property. Used as a base class for objects * Simple JavaBean domain object with an id property. Used as a base class for objects
* needing this property. * needing this property.
* *
* @author Ken Krebs * @author Ken Krebs
* @author Juergen Hoeller * @author Juergen Hoeller
*/ */
@MappedSuperclass @MappedSuperclass
public class BaseEntity implements Serializable { public class BaseEntity implements Serializable {
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id; private Integer id;
public Integer getId() { public Integer getId() {
return id; return id;
} }
public void setId(Integer id) { public void setId(Integer id) {
this.id = id; this.id = id;
} }
public boolean isNew() { public boolean isNew() {
return this.id == null; return this.id == null;
} }
} }

View file

@ -1,48 +1,48 @@
/* /*
* Copyright 2002-2013 the original author or authors. * Copyright 2002-2013 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.samples.kidclinic.model; package org.springframework.samples.kidclinic.model;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.MappedSuperclass; import javax.persistence.MappedSuperclass;
/** /**
* Simple JavaBean domain object adds a name property to <code>BaseEntity</code>. Used as a base class for objects * Simple JavaBean domain object adds a name property to <code>BaseEntity</code>. Used as a base class for objects
* needing these properties. * needing these properties.
* *
* @author Ken Krebs * @author Ken Krebs
* @author Juergen Hoeller * @author Juergen Hoeller
*/ */
@MappedSuperclass @MappedSuperclass
public class NamedEntity extends BaseEntity { public class NamedEntity extends BaseEntity {
@Column(name = "name") @Column(name = "name")
private String name; private String name;
public String getName() { public String getName() {
return this.name; return this.name;
} }
public void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
} }
@Override @Override
public String toString() { public String toString() {
return this.getName(); return this.getName();
} }
} }

View file

@ -1,55 +1,55 @@
/* /*
* Copyright 2002-2013 the original author or authors. * Copyright 2002-2013 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.samples.kidclinic.model; package org.springframework.samples.kidclinic.model;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.MappedSuperclass; import javax.persistence.MappedSuperclass;
import org.hibernate.validator.constraints.NotEmpty; import org.hibernate.validator.constraints.NotEmpty;
/** /**
* Simple JavaBean domain object representing an person. * Simple JavaBean domain object representing an person.
* *
* @author Ken Krebs * @author Ken Krebs
*/ */
@MappedSuperclass @MappedSuperclass
public class Person extends BaseEntity { public class Person extends BaseEntity {
@Column(name = "first_name") @Column(name = "first_name")
@NotEmpty @NotEmpty
private String firstName; private String firstName;
@Column(name = "last_name") @Column(name = "last_name")
@NotEmpty @NotEmpty
private String lastName; private String lastName;
public String getFirstName() { public String getFirstName() {
return this.firstName; return this.firstName;
} }
public void setFirstName(String firstName) { public void setFirstName(String firstName) {
this.firstName = firstName; this.firstName = firstName;
} }
public String getLastName() { public String getLastName() {
return this.lastName; return this.lastName;
} }
public void setLastName(String lastName) { public void setLastName(String lastName) {
this.lastName = lastName; this.lastName = lastName;
} }
} }

View file

@ -1,5 +1,5 @@
/** /**
* The classes in this package represent utilities used by the domain. * The classes in this package represent utilities used by the domain.
*/ */
package org.springframework.samples.kidclinic.model; package org.springframework.samples.kidclinic.model;

View file

@ -1,117 +1,117 @@
/* /*
* Copyright 2002-2013 the original author or authors. * Copyright 2002-2013 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.samples.kidclinic.parent; package org.springframework.samples.kidclinic.parent;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.HashSet; import java.util.HashSet;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.FetchType; import javax.persistence.FetchType;
import javax.persistence.JoinColumn; import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne; import javax.persistence.ManyToOne;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Temporal; import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
import org.springframework.beans.support.MutableSortDefinition; import org.springframework.beans.support.MutableSortDefinition;
import org.springframework.beans.support.PropertyComparator; import org.springframework.beans.support.PropertyComparator;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.samples.kidclinic.model.NamedEntity; import org.springframework.samples.kidclinic.model.NamedEntity;
import org.springframework.samples.kidclinic.visit.Visit; import org.springframework.samples.kidclinic.visit.Visit;
/** /**
* Simple business object representing a pet. * Simple business object representing a pet.
* *
* @author Ken Krebs * @author Ken Krebs
* @author Juergen Hoeller * @author Juergen Hoeller
* @author Sam Brannen * @author Sam Brannen
*/ */
@Entity @Entity
@Table(name = "kids") @Table(name = "kids")
public class Kid extends NamedEntity { public class Kid extends NamedEntity {
@Column(name = "birth_date") @Column(name = "birth_date")
@Temporal(TemporalType.DATE) @Temporal(TemporalType.DATE)
@DateTimeFormat(pattern = "yyyy/MM/dd") @DateTimeFormat(pattern = "yyyy/MM/dd")
private Date birthDate; private Date birthDate;
@ManyToOne @ManyToOne
@JoinColumn(name = "gender_id") @JoinColumn(name = "gender_id")
private KidGender gender; private KidGender gender;
@ManyToOne @ManyToOne
@JoinColumn(name = "parent_id") @JoinColumn(name = "parent_id")
private Parent parent; private Parent parent;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "kidId", fetch = FetchType.EAGER) @OneToMany(cascade = CascadeType.ALL, mappedBy = "kidId", fetch = FetchType.EAGER)
private Set<Visit> visits = new LinkedHashSet<>(); private Set<Visit> visits = new LinkedHashSet<>();
public void setBirthDate(Date birthDate) { public void setBirthDate(Date birthDate) {
this.birthDate = birthDate; this.birthDate = birthDate;
} }
public Date getBirthDate() { public Date getBirthDate() {
return this.birthDate; return this.birthDate;
} }
public KidGender getGender() { public KidGender getGender() {
return this.gender; return this.gender;
} }
public void setGender(KidGender gender) { public void setGender(KidGender gender) {
this.gender = gender; this.gender = gender;
} }
public Parent getParent() { public Parent getParent() {
return this.parent; return this.parent;
} }
protected void setParent(Parent parent) { protected void setParent(Parent parent) {
this.parent = parent; this.parent = parent;
} }
protected Set<Visit> getVisitsInternal() { protected Set<Visit> getVisitsInternal() {
if (this.visits == null) { if (this.visits == null) {
this.visits = new HashSet<>(); this.visits = new HashSet<>();
} }
return this.visits; return this.visits;
} }
protected void setVisitsInternal(Set<Visit> visits) { protected void setVisitsInternal(Set<Visit> visits) {
this.visits = visits; this.visits = visits;
} }
public List<Visit> getVisits() { public List<Visit> getVisits() {
List<Visit> sortedVisits = new ArrayList<>(getVisitsInternal()); List<Visit> sortedVisits = new ArrayList<>(getVisitsInternal());
PropertyComparator.sort(sortedVisits, PropertyComparator.sort(sortedVisits,
new MutableSortDefinition("date", false, false)); new MutableSortDefinition("date", false, false));
return Collections.unmodifiableList(sortedVisits); return Collections.unmodifiableList(sortedVisits);
} }
public void addVisit(Visit visit) { public void addVisit(Visit visit) {
getVisitsInternal().add(visit); getVisitsInternal().add(visit);
visit.setKidId(this.getId()); visit.setKidId(this.getId());
} }
} }

View file

@ -1,116 +1,116 @@
/* /*
* Copyright 2002-2013 the original author or authors. * Copyright 2002-2013 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.samples.kidclinic.parent; package org.springframework.samples.kidclinic.parent;
import java.util.Collection; import java.util.Collection;
import javax.validation.Valid; import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder; import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
/** /**
* @author Juergen Hoeller * @author Juergen Hoeller
* @author Ken Krebs * @author Ken Krebs
* @author Arjen Poutsma * @author Arjen Poutsma
*/ */
@Controller @Controller
@RequestMapping("/parents/{parentId}") @RequestMapping("/parents/{parentId}")
class KidController { class KidController {
private static final String VIEWS_KIDS_CREATE_OR_UPDATE_FORM = "kids/createOrUpdateKidForm"; private static final String VIEWS_KIDS_CREATE_OR_UPDATE_FORM = "kids/createOrUpdateKidForm";
private final KidRepository kids; private final KidRepository kids;
private final ParentRepository parents; private final ParentRepository parents;
@Autowired @Autowired
public KidController(KidRepository kids, ParentRepository parents) { public KidController(KidRepository kids, ParentRepository parents) {
this.kids = kids; this.kids = kids;
this.parents = parents; this.parents = parents;
} }
@ModelAttribute("gender") @ModelAttribute("gender")
public Collection<KidGender> populateKidGenders() { public Collection<KidGender> populateKidGenders() {
return this.kids.findKidGenders(); return this.kids.findKidGenders();
} }
@ModelAttribute("parent") @ModelAttribute("parent")
public Parent findParent(@PathVariable("parentId") int parentId) { public Parent findParent(@PathVariable("parentId") int parentId) {
return this.parents.findById(parentId); return this.parents.findById(parentId);
} }
@InitBinder("parent") @InitBinder("parent")
public void initParentBinder(WebDataBinder dataBinder) { public void initParentBinder(WebDataBinder dataBinder) {
dataBinder.setDisallowedFields("id"); dataBinder.setDisallowedFields("id");
} }
@InitBinder("kid") @InitBinder("kid")
public void initKidBinder(WebDataBinder dataBinder) { public void initKidBinder(WebDataBinder dataBinder) {
dataBinder.setValidator(new KidValidator()); dataBinder.setValidator(new KidValidator());
} }
@RequestMapping(value = "/kids/new", method = RequestMethod.GET) @RequestMapping(value = "/kids/new", method = RequestMethod.GET)
public String initCreationForm(Parent parent, ModelMap model) { public String initCreationForm(Parent parent, ModelMap model) {
Kid kid = new Kid(); Kid kid = new Kid();
parent.addKid(kid); parent.addKid(kid);
model.put("kid", kid); model.put("kid", kid);
return VIEWS_KIDS_CREATE_OR_UPDATE_FORM; return VIEWS_KIDS_CREATE_OR_UPDATE_FORM;
} }
@RequestMapping(value = "/kids/new", method = RequestMethod.POST) @RequestMapping(value = "/kids/new", method = RequestMethod.POST)
public String processCreationForm(Parent parent, @Valid Kid kid, BindingResult result, ModelMap model) { public String processCreationForm(Parent parent, @Valid Kid kid, BindingResult result, ModelMap model) {
if (StringUtils.hasLength(kid.getName()) && kid.isNew() && parent.getKid(kid.getName(), true) != null){ if (StringUtils.hasLength(kid.getName()) && kid.isNew() && parent.getKid(kid.getName(), true) != null){
result.rejectValue("name", "duplicate", "already exists"); result.rejectValue("name", "duplicate", "already exists");
} }
if (result.hasErrors()) { if (result.hasErrors()) {
model.put("kid", kid); model.put("kid", kid);
return VIEWS_KIDS_CREATE_OR_UPDATE_FORM; return VIEWS_KIDS_CREATE_OR_UPDATE_FORM;
} else { } else {
parent.addKid(kid); parent.addKid(kid);
this.kids.save(kid); this.kids.save(kid);
return "redirect:/parents/{parentId}"; return "redirect:/parents/{parentId}";
} }
} }
@RequestMapping(value = "/kids/{kidId}/edit", method = RequestMethod.GET) @RequestMapping(value = "/kids/{kidId}/edit", method = RequestMethod.GET)
public String initUpdateForm(@PathVariable("kidId") int kidId, ModelMap model) { public String initUpdateForm(@PathVariable("kidId") int kidId, ModelMap model) {
Kid kid = this.kids.findById(kidId); Kid kid = this.kids.findById(kidId);
model.put("kid", kid); model.put("kid", kid);
return VIEWS_KIDS_CREATE_OR_UPDATE_FORM; return VIEWS_KIDS_CREATE_OR_UPDATE_FORM;
} }
@RequestMapping(value = "/kids/{kidsId}/edit", method = RequestMethod.POST) @RequestMapping(value = "/kids/{kidsId}/edit", method = RequestMethod.POST)
public String processUpdateForm(@Valid Kid kid, BindingResult result, Parent parent, ModelMap model) { public String processUpdateForm(@Valid Kid kid, BindingResult result, Parent parent, ModelMap model) {
if (result.hasErrors()) { if (result.hasErrors()) {
kid.setParent(parent); kid.setParent(parent);
model.put("kid", kid); model.put("kid", kid);
return VIEWS_KIDS_CREATE_OR_UPDATE_FORM; return VIEWS_KIDS_CREATE_OR_UPDATE_FORM;
} else { } else {
parent.addKid(kid); parent.addKid(kid);
this.kids.save(kid); this.kids.save(kid);
return "redirect:/parents/{parentId}"; return "redirect:/parents/{parentId}";
} }
} }
} }

View file

@ -1,31 +1,31 @@
/* /*
* Copyright 2002-2013 the original author or authors. * Copyright 2002-2013 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.samples.kidclinic.parent; package org.springframework.samples.kidclinic.parent;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Table; import javax.persistence.Table;
import org.springframework.samples.kidclinic.model.NamedEntity; import org.springframework.samples.kidclinic.model.NamedEntity;
/** /**
* @author Juergen Hoeller * @author Juergen Hoeller
* Can be Cat, Dog, Hamster... * Can be Cat, Dog, Hamster...
*/ */
@Entity @Entity
@Table(name = "gender") @Table(name = "gender")
public class KidGender extends NamedEntity { public class KidGender extends NamedEntity {
} }

View file

@ -1,65 +1,65 @@
/* /*
* Copyright 2002-2013 the original author or authors. * Copyright 2002-2013 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.samples.kidclinic.parent; package org.springframework.samples.kidclinic.parent;
import java.text.ParseException; import java.text.ParseException;
import java.util.Collection; import java.util.Collection;
import java.util.Locale; import java.util.Locale;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.Formatter; import org.springframework.format.Formatter;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/** /**
* Instructs Spring MVC on how to parse and print elements of type 'KidGender'. Starting from Spring 3.0, Formatters have * Instructs Spring MVC on how to parse and print elements of type 'KidGender'. Starting from Spring 3.0, Formatters have
* come as an improvement in comparison to legacy PropertyEditors. See the following links for more details: - The * come as an improvement in comparison to legacy PropertyEditors. See the following links for more details: - The
* Spring ref doc: http://static.springsource.org/spring/docs/current/spring-framework-reference/html/validation.html#format-Formatter-SPI * Spring ref doc: http://static.springsource.org/spring/docs/current/spring-framework-reference/html/validation.html#format-Formatter-SPI
* - A nice blog entry from Gordon Dickens: http://gordondickens.com/wordpress/2010/09/30/using-spring-3-0-custom-type-converter/ * - A nice blog entry from Gordon Dickens: http://gordondickens.com/wordpress/2010/09/30/using-spring-3-0-custom-type-converter/
* <p/> * <p/>
* *
* @author Mark Fisher * @author Mark Fisher
* @author Juergen Hoeller * @author Juergen Hoeller
* @author Michael Isvy * @author Michael Isvy
*/ */
@Component @Component
public class KidGenderFormatter implements Formatter<KidGender> { public class KidGenderFormatter implements Formatter<KidGender> {
private final KidRepository kids; private final KidRepository kids;
@Autowired @Autowired
public KidGenderFormatter(KidRepository kids) { public KidGenderFormatter(KidRepository kids) {
this.kids = kids; this.kids = kids;
} }
@Override @Override
public String print(KidGender kidGender, Locale locale) { public String print(KidGender kidGender, Locale locale) {
return kidGender.getName(); return kidGender.getName();
} }
@Override @Override
public KidGender parse(String text, Locale locale) throws ParseException { public KidGender parse(String text, Locale locale) throws ParseException {
Collection<KidGender> findKidGenders = this.kids.findKidGenders(); Collection<KidGender> findKidGenders = this.kids.findKidGenders();
for (KidGender gender : findKidGenders) { for (KidGender gender : findKidGenders) {
if (gender.getName().equals(text)) { if (gender.getName().equals(text)) {
return gender; return gender;
} }
} }
throw new ParseException("gender not found: " + text, 0); throw new ParseException("gender not found: " + text, 0);
} }
} }

View file

@ -1,58 +1,58 @@
/* /*
* Copyright 2002-2013 the original author or authors. * Copyright 2002-2013 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.samples.kidclinic.parent; package org.springframework.samples.kidclinic.parent;
import java.util.List; import java.util.List;
import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.Repository; import org.springframework.data.repository.Repository;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
/** /**
* Repository class for <code>Kid</code> domain objects All method names are compliant with Spring Data naming * Repository class for <code>Kid</code> domain objects All method names are compliant with Spring Data naming
* conventions so this interface can easily be extended for Spring Data See here: http://static.springsource.org/spring-data/jpa/docs/current/reference/html/jpa.repositories.html#jpa.query-methods.query-creation * conventions so this interface can easily be extended for Spring Data See here: http://static.springsource.org/spring-data/jpa/docs/current/reference/html/jpa.repositories.html#jpa.query-methods.query-creation
* *
* @author Ken Krebs * @author Ken Krebs
* @author Juergen Hoeller * @author Juergen Hoeller
* @author Sam Brannen * @author Sam Brannen
* @author Michael Isvy * @author Michael Isvy
*/ */
public interface KidRepository extends Repository<Kid, Integer> { public interface KidRepository extends Repository<Kid, Integer> {
/** /**
* Retrieve all {@link KidGender}s from the data store. * Retrieve all {@link KidGender}s from the data store.
* @return a Collection of {@link KidGender}s. * @return a Collection of {@link KidGender}s.
*/ */
@Query("SELECT ptype FROM KidGender ptype ORDER BY ptype.name") @Query("SELECT ptype FROM KidGender ptype ORDER BY ptype.name")
@Transactional(readOnly = true) @Transactional(readOnly = true)
List<KidGender> findKidGenders(); List<KidGender> findKidGenders();
/** /**
* Retrieve a {@link Kid} from the data store by id. * Retrieve a {@link Kid} from the data store by id.
* @param id the id to search for * @param id the id to search for
* @return the {@link Kid} if found * @return the {@link Kid} if found
*/ */
@Transactional(readOnly = true) @Transactional(readOnly = true)
Kid findById(Integer id); Kid findById(Integer id);
/** /**
* Save a {@link Kid} to the data store, either inserting or updating it. * Save a {@link Kid} to the data store, either inserting or updating it.
* @param kid the {@link Kid} to save * @param kid the {@link Kid} to save
*/ */
void save(Kid kid); void save(Kid kid);
} }

View file

@ -1,64 +1,64 @@
/* /*
* Copyright 2002-2013 the original author or authors. * Copyright 2002-2013 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.samples.kidclinic.parent; package org.springframework.samples.kidclinic.parent;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.validation.Errors; import org.springframework.validation.Errors;
import org.springframework.validation.Validator; import org.springframework.validation.Validator;
/** /**
* <code>Validator</code> for <code>Kid</code> forms. * <code>Validator</code> for <code>Kid</code> forms.
* <p> * <p>
* We're not using Bean Validation annotations here because it is easier to define such validation rule in Java. * We're not using Bean Validation annotations here because it is easier to define such validation rule in Java.
* </p> * </p>
* *
* @author Ken Krebs * @author Ken Krebs
* @author Juergen Hoeller * @author Juergen Hoeller
*/ */
public class KidValidator implements Validator { public class KidValidator implements Validator {
private static final String REQUIRED = "required"; private static final String REQUIRED = "required";
@Override @Override
public void validate(Object obj, Errors errors) { public void validate(Object obj, Errors errors) {
Kid kid = (Kid) obj; Kid kid = (Kid) obj;
String name = kid.getName(); String name = kid.getName();
// name validation // name validation
if (!StringUtils.hasLength(name)) { if (!StringUtils.hasLength(name)) {
errors.rejectValue("name", REQUIRED, REQUIRED); errors.rejectValue("name", REQUIRED, REQUIRED);
} }
// gender validation // gender validation
if (kid.isNew() && kid.getGender() == null) { if (kid.isNew() && kid.getGender() == null) {
errors.rejectValue("gender", REQUIRED, REQUIRED); errors.rejectValue("gender", REQUIRED, REQUIRED);
} }
// birth date validation // birth date validation
if (kid.getBirthDate() == null) { if (kid.getBirthDate() == null) {
errors.rejectValue("birthDate", REQUIRED, REQUIRED); errors.rejectValue("birthDate", REQUIRED, REQUIRED);
} }
} }
/** /**
* This Validator validates *just* Kid instances * This Validator validates *just* Kid instances
*/ */
@Override @Override
public boolean supports(Class<?> clazz) { public boolean supports(Class<?> clazz) {
return Kid.class.isAssignableFrom(clazz); return Kid.class.isAssignableFrom(clazz);
} }
} }

View file

@ -1,156 +1,156 @@
/* /*
* Copyright 2002-2013 the original author or authors. * Copyright 2002-2013 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.samples.kidclinic.parent; package org.springframework.samples.kidclinic.parent;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import javax.persistence.Table; import javax.persistence.Table;
import javax.validation.constraints.Digits; import javax.validation.constraints.Digits;
import org.hibernate.validator.constraints.NotEmpty; import org.hibernate.validator.constraints.NotEmpty;
import org.springframework.beans.support.MutableSortDefinition; import org.springframework.beans.support.MutableSortDefinition;
import org.springframework.beans.support.PropertyComparator; import org.springframework.beans.support.PropertyComparator;
import org.springframework.core.style.ToStringCreator; import org.springframework.core.style.ToStringCreator;
import org.springframework.samples.kidclinic.model.Person; import org.springframework.samples.kidclinic.model.Person;
/** /**
* Simple JavaBean domain object representing an parent. * Simple JavaBean domain object representing an parent.
* *
* @author Ken Krebs * @author Ken Krebs
* @author Juergen Hoeller * @author Juergen Hoeller
* @author Sam Brannen * @author Sam Brannen
* @author Michael Isvy * @author Michael Isvy
*/ */
@Entity @Entity
@Table(name = "parents") @Table(name = "parents")
public class Parent extends Person { public class Parent extends Person {
@Column(name = "address") @Column(name = "address")
@NotEmpty @NotEmpty
private String address; private String address;
@Column(name = "city") @Column(name = "city")
@NotEmpty @NotEmpty
private String city; private String city;
@Column(name = "telephone") @Column(name = "telephone")
@NotEmpty @NotEmpty
@Digits(fraction = 0, integer = 10) @Digits(fraction = 0, integer = 10)
private String telephone; private String telephone;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "parent") @OneToMany(cascade = CascadeType.ALL, mappedBy = "parent")
private Set<Kid> kids; private Set<Kid> kids;
public String getAddress() { public String getAddress() {
return this.address; return this.address;
} }
public void setAddress(String address) { public void setAddress(String address) {
this.address = address; this.address = address;
} }
public String getCity() { public String getCity() {
return this.city; return this.city;
} }
public void setCity(String city) { public void setCity(String city) {
this.city = city; this.city = city;
} }
public String getTelephone() { public String getTelephone() {
return this.telephone; return this.telephone;
} }
public void setTelephone(String telephone) { public void setTelephone(String telephone) {
this.telephone = telephone; this.telephone = telephone;
} }
protected Set<Kid> getKidsInternal() { protected Set<Kid> getKidsInternal() {
if (this.kids == null) { if (this.kids == null) {
this.kids = new HashSet<>(); this.kids = new HashSet<>();
} }
return this.kids; return this.kids;
} }
protected void setKidsInternal(Set<Kid> kids) { protected void setKidsInternal(Set<Kid> kids) {
this.kids = kids; this.kids = kids;
} }
public List<Kid> getKids() { public List<Kid> getKids() {
List<Kid> sortedKids = new ArrayList<>(getKidsInternal()); List<Kid> sortedKids = new ArrayList<>(getKidsInternal());
PropertyComparator.sort(sortedKids, new MutableSortDefinition("name", true, true)); PropertyComparator.sort(sortedKids, new MutableSortDefinition("name", true, true));
return Collections.unmodifiableList(sortedKids); return Collections.unmodifiableList(sortedKids);
} }
public void addKid(Kid kid) { public void addKid(Kid kid) {
if (kid.isNew()) { if (kid.isNew()) {
getKidsInternal().add(kid); getKidsInternal().add(kid);
} }
kid.setParent(this); kid.setParent(this);
} }
/** /**
* Return the Kid with the given name, or null if none found for this Parent. * Return the Kid with the given name, or null if none found for this Parent.
* *
* @param name to test * @param name to test
* @return true if kid name is already in use * @return true if kid name is already in use
*/ */
public Kid getKid(String name) { public Kid getKid(String name) {
return getKid(name, false); return getKid(name, false);
} }
/** /**
* Return the Kid with the given name, or null if none found for this Kid. * Return the Kid with the given name, or null if none found for this Kid.
* *
* @param name to test * @param name to test
* @return true if kid name is already in use * @return true if kid name is already in use
*/ */
public Kid getKid(String name, boolean ignoreNew) { public Kid getKid(String name, boolean ignoreNew) {
name = name.toLowerCase(); name = name.toLowerCase();
for (Kid kid : getKidsInternal()) { for (Kid kid : getKidsInternal()) {
if (!ignoreNew || !kid.isNew()) { if (!ignoreNew || !kid.isNew()) {
String compName = kid.getName(); String compName = kid.getName();
compName = compName.toLowerCase(); compName = compName.toLowerCase();
if (compName.equals(name)) { if (compName.equals(name)) {
return kid; return kid;
} }
} }
} }
return null; return null;
} }
@Override @Override
public String toString() { public String toString() {
return new ToStringCreator(this) return new ToStringCreator(this)
.append("id", this.getId()) .append("id", this.getId())
.append("new", this.isNew()) .append("new", this.isNew())
.append("lastName", this.getLastName()) .append("lastName", this.getLastName())
.append("firstName", this.getFirstName()) .append("firstName", this.getFirstName())
.append("address", this.address) .append("address", this.address)
.append("city", this.city) .append("city", this.city)
.append("telephone", this.telephone) .append("telephone", this.telephone)
.toString(); .toString();
} }
} }

View file

@ -1,136 +1,136 @@
/* /*
* Copyright 2002-2013 the original author or authors. * Copyright 2002-2013 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.samples.kidclinic.parent; package org.springframework.samples.kidclinic.parent;
import java.util.Collection; import java.util.Collection;
import java.util.Map; import java.util.Map;
import javax.validation.Valid; import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder; import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
/** /**
* @author Juergen Hoeller * @author Juergen Hoeller
* @author Ken Krebs * @author Ken Krebs
* @author Arjen Poutsma * @author Arjen Poutsma
* @author Michael Isvy * @author Michael Isvy
*/ */
@Controller @Controller
class ParentController { class ParentController {
private static final String VIEWS_PARENT_CREATE_OR_UPDATE_FORM = "parents/createOrUpdateParentForm"; private static final String VIEWS_PARENT_CREATE_OR_UPDATE_FORM = "parents/createOrUpdateParentForm";
private final ParentRepository parents; private final ParentRepository parents;
@Autowired @Autowired
public ParentController(ParentRepository clinicService) { public ParentController(ParentRepository clinicService) {
this.parents = clinicService; this.parents = clinicService;
} }
@InitBinder @InitBinder
public void setAllowedFields(WebDataBinder dataBinder) { public void setAllowedFields(WebDataBinder dataBinder) {
dataBinder.setDisallowedFields("id"); dataBinder.setDisallowedFields("id");
} }
@RequestMapping(value = "/parents/new", method = RequestMethod.GET) @RequestMapping(value = "/parents/new", method = RequestMethod.GET)
public String initCreationForm(Map<String, Object> model) { public String initCreationForm(Map<String, Object> model) {
Parent parent = new Parent(); Parent parent = new Parent();
model.put("parent", parent); model.put("parent", parent);
return VIEWS_PARENT_CREATE_OR_UPDATE_FORM; return VIEWS_PARENT_CREATE_OR_UPDATE_FORM;
} }
@RequestMapping(value = "/parents/new", method = RequestMethod.POST) @RequestMapping(value = "/parents/new", method = RequestMethod.POST)
public String processCreationForm(@Valid Parent parent, BindingResult result) { public String processCreationForm(@Valid Parent parent, BindingResult result) {
if (result.hasErrors()) { if (result.hasErrors()) {
return VIEWS_PARENT_CREATE_OR_UPDATE_FORM; return VIEWS_PARENT_CREATE_OR_UPDATE_FORM;
} else { } else {
this.parents.save(parent); this.parents.save(parent);
return "redirect:/parents/" + parent.getId(); return "redirect:/parents/" + parent.getId();
} }
} }
@RequestMapping(value = "/parents/find", method = RequestMethod.GET) @RequestMapping(value = "/parents/find", method = RequestMethod.GET)
public String initFindForm(Map<String, Object> model) { public String initFindForm(Map<String, Object> model) {
model.put("parent", new Parent()); model.put("parent", new Parent());
return "parents/findParents"; return "parents/findParents";
} }
@RequestMapping(value = "/parents", method = RequestMethod.GET) @RequestMapping(value = "/parents", method = RequestMethod.GET)
public String processFindForm(Parent parent, BindingResult result, Map<String, Object> model) { public String processFindForm(Parent parent, BindingResult result, Map<String, Object> model) {
// allow parameterless GET request for /parents to return all records // allow parameterless GET request for /parents to return all records
if (parent.getLastName() == null) { if (parent.getLastName() == null) {
parent.setLastName(""); // empty string signifies broadest possible search parent.setLastName(""); // empty string signifies broadest possible search
} }
// find parents by last name // find parents by last name
Collection<Parent> results = this.parents.findByLastName(parent.getLastName()); Collection<Parent> results = this.parents.findByLastName(parent.getLastName());
if (results.isEmpty()) { if (results.isEmpty()) {
// no parents found // no parents found
result.rejectValue("lastName", "notFound", "not found"); result.rejectValue("lastName", "notFound", "not found");
return "parents/findParents"; return "parents/findParents";
} else if (results.size() == 1) { } else if (results.size() == 1) {
// 1 parent found // 1 parent found
parent = results.iterator().next(); parent = results.iterator().next();
return "redirect:/parents/" + parent.getId(); return "redirect:/parents/" + parent.getId();
} else { } else {
// multiple parents found // multiple parents found
model.put("selections", results); model.put("selections", results);
return "parents/parentsList"; return "parents/parentsList";
} }
} }
@RequestMapping(value = "/parents/{parentId}/edit", method = RequestMethod.GET) @RequestMapping(value = "/parents/{parentId}/edit", method = RequestMethod.GET)
public String initUpdateParentForm(@PathVariable("parentId") int parentId, Model model) { public String initUpdateParentForm(@PathVariable("parentId") int parentId, Model model) {
Parent parent = this.parents.findById(parentId); Parent parent = this.parents.findById(parentId);
model.addAttribute(parent); model.addAttribute(parent);
return VIEWS_PARENT_CREATE_OR_UPDATE_FORM; return VIEWS_PARENT_CREATE_OR_UPDATE_FORM;
} }
@RequestMapping(value = "/parents/{parentId}/edit", method = RequestMethod.POST) @RequestMapping(value = "/parents/{parentId}/edit", method = RequestMethod.POST)
public String processUpdateParentForm(@Valid Parent parent, BindingResult result, @PathVariable("parentId") int parentId) { public String processUpdateParentForm(@Valid Parent parent, BindingResult result, @PathVariable("parentId") int parentId) {
if (result.hasErrors()) { if (result.hasErrors()) {
return VIEWS_PARENT_CREATE_OR_UPDATE_FORM; return VIEWS_PARENT_CREATE_OR_UPDATE_FORM;
} else { } else {
parent.setId(parentId); parent.setId(parentId);
this.parents.save(parent); this.parents.save(parent);
return "redirect:/parents/{parentId}"; return "redirect:/parents/{parentId}";
} }
} }
/** /**
* Custom handler for displaying an parent. * Custom handler for displaying an parent.
* *
* @param parentId the ID of the parent to display * @param parentId the ID of the parent to display
* @return a ModelMap with the model attributes for the view * @return a ModelMap with the model attributes for the view
*/ */
@RequestMapping("/parents/{parentId}") @RequestMapping("/parents/{parentId}")
public ModelAndView showParent(@PathVariable("parentId") int parentId) { public ModelAndView showParent(@PathVariable("parentId") int parentId) {
ModelAndView mav = new ModelAndView("parents/parentDetails"); ModelAndView mav = new ModelAndView("parents/parentDetails");
mav.addObject(this.parents.findById(parentId)); mav.addObject(this.parents.findById(parentId));
return mav; return mav;
} }
} }

View file

@ -1,63 +1,63 @@
/* /*
* Copyright 2002-2013 the original author or authors. * Copyright 2002-2013 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.samples.kidclinic.parent; package org.springframework.samples.kidclinic.parent;
import java.util.Collection; import java.util.Collection;
import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.Repository; import org.springframework.data.repository.Repository;
import org.springframework.data.repository.query.Param; import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
/** /**
* Repository class for <code>Parent</code> domain objects All method names are compliant with Spring Data naming * Repository class for <code>Parent</code> domain objects All method names are compliant with Spring Data naming
* conventions so this interface can easily be extended for Spring Data See here: http://static.springsource.org/spring-data/jpa/docs/current/reference/html/jpa.repositories.html#jpa.query-methods.query-creation * conventions so this interface can easily be extended for Spring Data See here: http://static.springsource.org/spring-data/jpa/docs/current/reference/html/jpa.repositories.html#jpa.query-methods.query-creation
* *
* @author Ken Krebs * @author Ken Krebs
* @author Juergen Hoeller * @author Juergen Hoeller
* @author Sam Brannen * @author Sam Brannen
* @author Michael Isvy * @author Michael Isvy
*/ */
public interface ParentRepository extends Repository<Parent, Integer> { public interface ParentRepository extends Repository<Parent, Integer> {
/** /**
* Retrieve {@link Parent}s from the data store by last name, returning all parents * Retrieve {@link Parent}s from the data store by last name, returning all parents
* whose last name <i>starts</i> with the given name. * whose last name <i>starts</i> with the given name.
* @param lastName Value to search for * @param lastName Value to search for
* @return a Collection of matching {@link Parent}s (or an empty Collection if none * @return a Collection of matching {@link Parent}s (or an empty Collection if none
* found) * found)
*/ */
@Query("SELECT DISTINCT parent FROM Parent parent left join fetch parent.kids WHERE parent.lastName LIKE :lastName%") @Query("SELECT DISTINCT parent FROM Parent parent left join fetch parent.kids WHERE parent.lastName LIKE :lastName%")
@Transactional(readOnly = true) @Transactional(readOnly = true)
Collection<Parent> findByLastName(@Param("lastName") String lastName); Collection<Parent> findByLastName(@Param("lastName") String lastName);
/** /**
* Retrieve an {@link Parent} from the data store by id. * Retrieve an {@link Parent} from the data store by id.
* @param id the id to search for * @param id the id to search for
* @return the {@link Parent} if found * @return the {@link Parent} if found
*/ */
@Query("SELECT parent FROM Parent parent left join fetch parent.kids WHERE parent.id =:id") @Query("SELECT parent FROM Parent parent left join fetch parent.kids WHERE parent.id =:id")
@Transactional(readOnly = true) @Transactional(readOnly = true)
Parent findById(@Param("id") Integer id); Parent findById(@Param("id") Integer id);
/** /**
* Save an {@link Parent} to the data store, either inserting or updating it. * Save an {@link Parent} to the data store, either inserting or updating it.
* @param owner the {@link Parent} to save * @param owner the {@link Parent} to save
*/ */
void save(Parent parent); void save(Parent parent);
} }

View file

@ -1,95 +1,95 @@
/* /*
* Copyright 2002-2013 the original author or authors. * Copyright 2002-2013 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.samples.kidclinic.parent; package org.springframework.samples.kidclinic.parent;
import java.util.Map; import java.util.Map;
import javax.validation.Valid; import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.samples.kidclinic.visit.Visit; import org.springframework.samples.kidclinic.visit.Visit;
import org.springframework.samples.kidclinic.visit.VisitRepository; import org.springframework.samples.kidclinic.visit.VisitRepository;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder; import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
/** /**
* @author Juergen Hoeller * @author Juergen Hoeller
* @author Ken Krebs * @author Ken Krebs
* @author Arjen Poutsma * @author Arjen Poutsma
* @author Michael Isvy * @author Michael Isvy
* @author Dave Syer * @author Dave Syer
*/ */
@Controller @Controller
class VisitController { class VisitController {
private final VisitRepository visits; private final VisitRepository visits;
private final KidRepository kids; private final KidRepository kids;
@Autowired @Autowired
public VisitController(VisitRepository visits, KidRepository kids) { public VisitController(VisitRepository visits, KidRepository kids) {
this.visits = visits; this.visits = visits;
this.kids = kids; this.kids = kids;
} }
@InitBinder @InitBinder
public void setAllowedFields(WebDataBinder dataBinder) { public void setAllowedFields(WebDataBinder dataBinder) {
dataBinder.setDisallowedFields("id"); dataBinder.setDisallowedFields("id");
} }
/** /**
* Called before each and every @RequestMapping annotated method. * Called before each and every @RequestMapping annotated method.
* 2 goals: * 2 goals:
* - Make sure we always have fresh data * - Make sure we always have fresh data
* - Since we do not use the session scope, make sure that Kid object always has an id * - Since we do not use the session scope, make sure that Kid object always has an id
* (Even though id is not part of the form fields) * (Even though id is not part of the form fields)
* *
* @param kidId * @param kidId
* @return Kid * @return Kid
*/ */
@ModelAttribute("visit") @ModelAttribute("visit")
public Visit loadKidWithVisit(@PathVariable("kidId") int kidId, Map<String, Object> model) { public Visit loadKidWithVisit(@PathVariable("kidId") int kidId, Map<String, Object> model) {
Kid kid = this.kids.findById(kidId); Kid kid = this.kids.findById(kidId);
model.put("kid", kid); model.put("kid", kid);
Visit visit = new Visit(); Visit visit = new Visit();
kid.addVisit(visit); kid.addVisit(visit);
return visit; return visit;
} }
// Spring MVC calls method loadKidWithVisit(...) before initNewVisitForm is called // Spring MVC calls method loadKidWithVisit(...) before initNewVisitForm is called
@RequestMapping(value = "/parents/*/kids/{kidId}/visits/new", method = RequestMethod.GET) @RequestMapping(value = "/parents/*/kids/{kidId}/visits/new", method = RequestMethod.GET)
public String initNewVisitForm(@PathVariable("kidId") int kidId, Map<String, Object> model) { public String initNewVisitForm(@PathVariable("kidId") int kidId, Map<String, Object> model) {
return "kids/createOrUpdateVisitForm"; return "kids/createOrUpdateVisitForm";
} }
// Spring MVC calls method loadKidWithVisit(...) before processNewVisitForm is called // Spring MVC calls method loadKidWithVisit(...) before processNewVisitForm is called
@RequestMapping(value = "/parents/{parentId}/kids/{kidId}/visits/new", method = RequestMethod.POST) @RequestMapping(value = "/parents/{parentId}/kids/{kidId}/visits/new", method = RequestMethod.POST)
public String processNewVisitForm(@Valid Visit visit, BindingResult result) { public String processNewVisitForm(@Valid Visit visit, BindingResult result) {
if (result.hasErrors()) { if (result.hasErrors()) {
return "kids/createOrUpdateVisitForm"; return "kids/createOrUpdateVisitForm";
} else { } else {
this.visits.save(visit); this.visits.save(visit);
return "redirect:/parents/{parentId}"; return "redirect:/parents/{parentId}";
} }
} }
} }

View file

@ -1,32 +1,32 @@
package org.springframework.samples.kidclinic.system; package org.springframework.samples.kidclinic.system;
import javax.cache.configuration.Configuration; import javax.cache.configuration.Configuration;
import javax.cache.configuration.MutableConfiguration; import javax.cache.configuration.MutableConfiguration;
import org.springframework.boot.autoconfigure.cache.JCacheManagerCustomizer; import org.springframework.boot.autoconfigure.cache.JCacheManagerCustomizer;
import org.springframework.cache.annotation.EnableCaching; import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Profile; import org.springframework.context.annotation.Profile;
/** /**
* Cache could be disabled in unit test. * Cache could be disabled in unit test.
*/ */
@org.springframework.context.annotation.Configuration @org.springframework.context.annotation.Configuration
@EnableCaching @EnableCaching
@Profile("production") @Profile("production")
class CacheConfig { class CacheConfig {
@Bean @Bean
public JCacheManagerCustomizer cacheManagerCustomizer() { public JCacheManagerCustomizer cacheManagerCustomizer() {
return cm -> { return cm -> {
Configuration<Object, Object> cacheConfiguration = createCacheConfiguration(); Configuration<Object, Object> cacheConfiguration = createCacheConfiguration();
cm.createCache("doctors", cacheConfiguration); cm.createCache("doctors", cacheConfiguration);
}; };
} }
private Configuration<Object, Object> createCacheConfiguration() { private Configuration<Object, Object> createCacheConfiguration() {
// Create a cache using infinite heap. A real application will want to use an // Create a cache using infinite heap. A real application will want to use an
// implementation dependent configuration that will better fit your needs // implementation dependent configuration that will better fit your needs
return new MutableConfiguration<>().setStatisticsEnabled(true); return new MutableConfiguration<>().setStatisticsEnabled(true);
} }
} }

View file

@ -1,38 +1,38 @@
/* /*
* Copyright 2002-2013 the original author or authors. * Copyright 2002-2013 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.samples.kidclinic.system; package org.springframework.samples.kidclinic.system;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
/** /**
* Controller used to showcase what happens when an exception is thrown * Controller used to showcase what happens when an exception is thrown
* *
* @author Michael Isvy * @author Michael Isvy
* <p/> * <p/>
* Also see how a view that resolves to "error" has been added ("error.html"). * Also see how a view that resolves to "error" has been added ("error.html").
*/ */
@Controller @Controller
class CrashController { class CrashController {
@RequestMapping(value = "/oops", method = RequestMethod.GET) @RequestMapping(value = "/oops", method = RequestMethod.GET)
public String triggerException() { public String triggerException() {
throw new RuntimeException( throw new RuntimeException(
"Expected: controller used to showcase what " + "happens when an exception is thrown"); "Expected: controller used to showcase what " + "happens when an exception is thrown");
} }
} }

View file

@ -1,14 +1,14 @@
package org.springframework.samples.kidclinic.system; package org.springframework.samples.kidclinic.system;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@Controller @Controller
class WelcomeController { class WelcomeController {
@RequestMapping("/") @RequestMapping("/")
public String welcome() { public String welcome() {
return "welcome"; return "welcome";
} }
} }

View file

@ -1,124 +1,124 @@
/* /*
* Copyright 2002-2013 the original author or authors. * Copyright 2002-2013 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.samples.kidclinic.visit; package org.springframework.samples.kidclinic.visit;
import java.util.Date; import java.util.Date;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Temporal; import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
import org.hibernate.validator.constraints.NotEmpty; import org.hibernate.validator.constraints.NotEmpty;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.samples.kidclinic.model.BaseEntity; import org.springframework.samples.kidclinic.model.BaseEntity;
/** /**
* Simple JavaBean domain object representing a visit. * Simple JavaBean domain object representing a visit.
* *
* @author Ken Krebs * @author Ken Krebs
* @author Dave Syer * @author Dave Syer
*/ */
@Entity @Entity
@Table(name = "visits") @Table(name = "visits")
public class Visit extends BaseEntity { public class Visit extends BaseEntity {
/** /**
* Holds value of property date. * Holds value of property date.
*/ */
@Column(name = "visit_date") @Column(name = "visit_date")
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
@DateTimeFormat(pattern = "yyyy/MM/dd") @DateTimeFormat(pattern = "yyyy/MM/dd")
private Date date; private Date date;
/** /**
* Holds value of property description. * Holds value of property description.
*/ */
@NotEmpty @NotEmpty
@Column(name = "description") @Column(name = "description")
private String description; private String description;
/** /**
* Holds value of property pet. * Holds value of property pet.
*/ */
@Column(name = "kid_id") @Column(name = "kid_id")
private Integer kidId; private Integer kidId;
/** /**
* Creates a new instance of Visit for the current date * Creates a new instance of Visit for the current date
*/ */
public Visit() { public Visit() {
this.date = new Date(); this.date = new Date();
} }
/** /**
* Getter for property date. * Getter for property date.
* *
* @return Value of property date. * @return Value of property date.
*/ */
public Date getDate() { public Date getDate() {
return this.date; return this.date;
} }
/** /**
* Setter for property date. * Setter for property date.
* *
* @param date New value of property date. * @param date New value of property date.
*/ */
public void setDate(Date date) { public void setDate(Date date) {
this.date = date; this.date = date;
} }
/** /**
* Getter for property description. * Getter for property description.
* *
* @return Value of property description. * @return Value of property description.
*/ */
public String getDescription() { public String getDescription() {
return this.description; return this.description;
} }
/** /**
* Setter for property description. * Setter for property description.
* *
* @param description New value of property description. * @param description New value of property description.
*/ */
public void setDescription(String description) { public void setDescription(String description) {
this.description = description; this.description = description;
} }
/** /**
* Getter for property kid id. * Getter for property kid id.
* *
* @return Value of property kid id. * @return Value of property kid id.
*/ */
public Integer getKidId() { public Integer getKidId() {
return this.kidId; return this.kidId;
} }
/** /**
* Setter for property kid id. * Setter for property kid id.
* *
* @param petId New value of property kid id. * @param petId New value of property kid id.
*/ */
public void setKidId(Integer kidId) { public void setKidId(Integer kidId) {
this.kidId = kidId; this.kidId = kidId;
} }
} }

View file

@ -1,45 +1,45 @@
/* /*
* Copyright 2002-2013 the original author or authors. * Copyright 2002-2013 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.samples.kidclinic.visit; package org.springframework.samples.kidclinic.visit;
import java.util.List; import java.util.List;
import org.springframework.dao.DataAccessException; import org.springframework.dao.DataAccessException;
import org.springframework.data.repository.Repository; import org.springframework.data.repository.Repository;
import org.springframework.samples.kidclinic.model.BaseEntity; import org.springframework.samples.kidclinic.model.BaseEntity;
/** /**
* Repository class for <code>Visit</code> domain objects All method names are compliant with Spring Data naming * Repository class for <code>Visit</code> domain objects All method names are compliant with Spring Data naming
* conventions so this interface can easily be extended for Spring Data See here: http://static.springsource.org/spring-data/jpa/docs/current/reference/html/jpa.repositories.html#jpa.query-methods.query-creation * conventions so this interface can easily be extended for Spring Data See here: http://static.springsource.org/spring-data/jpa/docs/current/reference/html/jpa.repositories.html#jpa.query-methods.query-creation
* *
* @author Ken Krebs * @author Ken Krebs
* @author Juergen Hoeller * @author Juergen Hoeller
* @author Sam Brannen * @author Sam Brannen
* @author Michael Isvy * @author Michael Isvy
*/ */
public interface VisitRepository extends Repository<Visit, Integer> { public interface VisitRepository extends Repository<Visit, Integer> {
/** /**
* Save a <code>Visit</code> to the data store, either inserting or updating it. * Save a <code>Visit</code> to the data store, either inserting or updating it.
* *
* @param visit the <code>Visit</code> to save * @param visit the <code>Visit</code> to save
* @see BaseEntity#isNew * @see BaseEntity#isNew
*/ */
void save(Visit visit) throws DataAccessException; void save(Visit visit) throws DataAccessException;
List<Visit> findByKidId(Integer kidId); List<Visit> findByKidId(Integer kidId);
} }

View file

@ -1,78 +1,78 @@
.navbar { .navbar {
//border-top: 4px solid #4286f4; //border-top: 4px solid #4286f4;
background-color: transparent; background-color: transparent;
margin-bottom: 40px; margin-bottom: 40px;
border-bottom: 0; border-bottom: 0;
border-left: 0; border-left: 0;
border-right: 0; border-right: 0;
postion: fixed; postion: fixed;
top: 0; top: 0;
} }
/* /*
.navbar a.navbar-brand { .navbar a.navbar-brand {
background: url("../images/spring-logo-dataflow.png") -1px -1px no-repeat; background: url("../images/spring-logo-dataflow.png") -1px -1px no-repeat;
margin: 12px 0 6px; margin: 12px 0 6px;
width: 229px; width: 229px;
height: 46px; height: 46px;
display: inline-block; display: inline-block;
text-decoration: none; text-decoration: none;
padding: 0; padding: 0;
} }
.navbar a.navbar-brand span { .navbar a.navbar-brand span {
display: block; display: block;
width: 229px; width: 229px;
height: 46px; height: 46px;
background: url("../images/spring-logo-dataflow.png") -1px -48px no-repeat; background: url("../images/spring-logo-dataflow.png") -1px -48px no-repeat;
opacity: 0; opacity: 0;
-moz-transition: opacity 0.12s ease-in-out; -moz-transition: opacity 0.12s ease-in-out;
-webkit-transition: opacity 0.12s ease-in-out; -webkit-transition: opacity 0.12s ease-in-out;
-o-transition: opacity 0.12s ease-in-out; -o-transition: opacity 0.12s ease-in-out;
} }
*/ */
.navbar a:hover.navbar-brand span { .navbar a:hover.navbar-brand span {
opacity: 1; opacity: 1;
} }
.navbar li > a, .navbar-text { .navbar li > a, .navbar-text {
font-family: "montserratregular", sans-serif; font-family: "montserratregular", sans-serif;
text-shadow: none; text-shadow: none;
font-size: 14px; font-size: 14px;
/* line-height: 14px; */ /* line-height: 14px; */
padding: 28px 20px; padding: 28px 20px;
transition: all 0.15s; transition: all 0.15s;
-webkit-transition: all 0.15s; -webkit-transition: all 0.15s;
-moz-transition: all 0.15s; -moz-transition: all 0.15s;
-o-transition: all 0.15s; -o-transition: all 0.15s;
-ms-transition: all 0.15s; -ms-transition: all 0.15s;
} }
.navbar li > a { .navbar li > a {
text-transform: uppercase; text-transform: uppercase;
} }
.navbar .navbar-text { .navbar .navbar-text {
margin-top: 0; margin-top: 0;
margin-bottom: 0; margin-bottom: 0;
} }
.navbar li:hover > a { .navbar li:hover > a {
color: #eeeeee; color: #eeeeee;
background-color: #6db33f; background-color: #6db33f;
} }
.navbar-toggle { .navbar-toggle {
border-width: 0; border-width: 0;
.icon-bar + .icon-bar { .icon-bar + .icon-bar {
margin-top: 3px; margin-top: 3px;
} }
.icon-bar { .icon-bar {
width: 19px; width: 19px;
height: 3px; height: 3px;
} }
} }

View file

@ -1,485 +1,485 @@
/* /*
* Copyright 2016 the original author or authors. * Copyright 2016 the original author or authors.
* *
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
@icon-font-path: "../../webjars/bootstrap/fonts/"; @icon-font-path: "../../webjars/bootstrap/fonts/";
@spring-green: #4286f4; @spring-green: #4286f4;
@spring-dark-green: #2733ad; @spring-dark-green: #2733ad;
@spring-brown: #34302D; @spring-brown: #34302D;
@spring-grey: #838789; @spring-grey: #838789;
@spring-light-grey: #f1f1f1; @spring-light-grey: #f1f1f1;
@body-bg: transparent; @body-bg: transparent;
@text-color: @spring-brown; @text-color: @spring-brown;
@link-color: @spring-dark-green; @link-color: @spring-dark-green;
@link-hover-color: @spring-dark-green; @link-hover-color: @spring-dark-green;
@navbar-default-link-color: @spring-brown; @navbar-default-link-color: @spring-brown;
@navbar-default-link-active-color: @spring-brown; @navbar-default-link-active-color: @spring-brown;
@navbar-default-link-hover-color: @spring-brown; @navbar-default-link-hover-color: @spring-brown;
@navbar-default-link-hover-bg: @spring-green; @navbar-default-link-hover-bg: @spring-green;
@navbar-default-toggle-icon-bar-bg: @spring-light-grey; @navbar-default-toggle-icon-bar-bg: @spring-light-grey;
@navbar-default-toggle-hover-bg: transparent; @navbar-default-toggle-hover-bg: transparent;
@navbar-default-link-active-bg: @spring-green; @navbar-default-link-active-bg: @spring-green;
@border-radius-base: 0; @border-radius-base: 0;
@border-radius-large: 0; @border-radius-large: 0;
@border-radius-small: 0; @border-radius-small: 0;
@btn-default-color: @spring-light-grey; @btn-default-color: @spring-light-grey;
@btn-default-bg: @spring-brown; @btn-default-bg: @spring-brown;
@btn-default-border: @spring-green; @btn-default-border: @spring-green;
@nav-tabs-active-link-hover-color: @spring-light-grey; @nav-tabs-active-link-hover-color: @spring-light-grey;
@nav-tabs-active-link-hover-bg: @spring-brown; @nav-tabs-active-link-hover-bg: @spring-brown;
@nav-tabs-active-link-hover-border-color: @spring-brown; @nav-tabs-active-link-hover-border-color: @spring-brown;
@nav-tabs-border-color: @spring-brown; @nav-tabs-border-color: @spring-brown;
@pagination-active-bg: @spring-brown; @pagination-active-bg: @spring-brown;
@pagination-active-border: @spring-green; @pagination-active-border: @spring-green;
@table-border-color: @spring-brown; @table-border-color: @spring-brown;
.table > thead > tr > th { .table > thead > tr > th {
background-color: lighten(@spring-brown, 3%); background-color: lighten(@spring-brown, 3%);
color: @spring-light-grey; color: @spring-light-grey;
} }
.carousel { .carousel {
height: 100%; height: 100%;
width: 100%; width: 100%;
overflow:hidden; overflow:hidden;
} }
.carousel .carousel-inner { .carousel .carousel-inner {
height:100%; height:100%;
} }
.carousel .carousel-inner img { .carousel .carousel-inner img {
display:block; display:block;
object-fit: cover; object-fit: cover;
} }
.mycarousel { .mycarousel {
height: 100%; height: 100%;
width: 100%; width: 100%;
overflow:hidden; overflow:hidden;
} }
.navbar-brand { .navbar-brand {
padding-top: 28px; padding-top: 28px;
} }
.table-filter { .table-filter {
background-color: @spring-brown; background-color: @spring-brown;
padding: 9px 12px; padding: 9px 12px;
} }
.nav > li > a { .nav > li > a {
color: @spring-grey; color: @spring-grey;
} }
.btn-default { .btn-default {
border-width: 2px; border-width: 2px;
transition: border 0.15s; transition: border 0.15s;
-webkit-transition: border 0.15s; -webkit-transition: border 0.15s;
-moz-transition: border 0.15s; -moz-transition: border 0.15s;
-o-transition: border 0.15s; -o-transition: border 0.15s;
-ms-transition: border 0.15s; -ms-transition: border 0.15s;
&:hover, &:hover,
&:focus, &:focus,
&:active, &:active,
&.active, &.active,
.open .dropdown-toggle& { .open .dropdown-toggle& {
background-color: @spring-brown; background-color: @spring-brown;
border-color: @spring-brown; border-color: @spring-brown;
} }
} }
.container .text-muted { .container .text-muted {
//margin: 20px 0; //margin: 20px 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.container-custom .container-custom
{ {
margin-right:auto; margin-right:auto;
margin-left:auto; margin-left:auto;
text-align:center; text-align:center;
position:fixed; position:fixed;
z-index: 2; z-index: 2;
background-color: white; background-color: white;
width: 100%; width: 100%;
color: black; color: black;
} }
code { code {
font-size: 80%; font-size: 80%;
} }
.xd-container { .xd-container {
margin-top: 15px; margin-top: 15px;
//margin-bottom: 100px; //margin-bottom: 100px;
padding-left: 0px; padding-left: 0px;
padding-right: 0px; padding-right: 0px;
overflow:hidden; overflow:hidden;
width: 100%; width: 100%;
height: 100%; height: 100%;
//margin-right: -60px; //margin-right: -60px;
} }
/////// ///////
.portion { .portion {
background-position: center center; background-position: center center;
background-attachment: fixed; background-attachment: fixed;
background-size: cover; background-size: cover;
text-align: center; text-align: center;
} }
.portion.two { .portion.two {
background-image: url("../images/healthcare.jpg") background-image: url("../images/healthcare.jpg")
} }
.portion.four { .portion.four {
background-image: url("../images/healthcare3.jpg") background-image: url("../images/healthcare3.jpg")
} }
.portion.five{ .portion.five{
background-image: url("../images/healthcare4.jpg") background-image: url("../images/healthcare4.jpg")
} }
.portion h2 { .portion h2 {
color: white; color: white;
font-weight: normal; font-weight: normal;
font-size: 3em; font-size: 3em;
padding: 2em 0; padding: 2em 0;
margin: 0; margin: 0;
text-shadow: 0 0 10px black; text-shadow: 0 0 10px black;
background: rgba(0,0,0,0.6); background: rgba(0,0,0,0.6);
} }
.info { .info {
background: #FFFAF0; background: #FFFAF0;
color: #777; color: #777;
padding: 3em 20%; padding: 3em 20%;
} }
.button { .button {
text-align: center; text-align: center;
} }
.button a { .button a {
display: inline-block; display: inline-block;
border: 2px solid #777; border: 2px solid #777;
padding: .75em 1.5em; padding: .75em 1.5em;
color: #777; color: #777;
text-decoration: none; text-decoration: none;
text-transform: uppercase; text-transform: uppercase;
border-radius: 5px; border-radius: 5px;
letter-spacing: .15em; letter-spacing: .15em;
word-spacing: .25em; word-spacing: .25em;
font-weight: bold; font-weight: bold;
transition: all 0.3s ease-in-out; transition: all 0.3s ease-in-out;
} }
.button a:hover { .button a:hover {
color: #FFFAF0; color: #FFFAF0;
background: #777; background: #777;
} }
footer.info { footer.info {
color: #FFFAF0; color: #FFFAF0;
background: #777; background: #777;
padding: 0 auto; padding: 0 auto;
text-align: center; text-align: center;
} }
.cd-top.cd-is-visible { .cd-top.cd-is-visible {
/* the button becomes visible */ /* the button becomes visible */
visibility: visible; visibility: visible;
opacity: 1; opacity: 1;
} }
.cd-top.cd-fade-out { .cd-top.cd-fade-out {
/* if the user keeps scrolling down, the button is out of focus and becomes less visible */ /* if the user keeps scrolling down, the button is out of focus and becomes less visible */
opacity: .5; opacity: .5;
} }
.return-to-top { .return-to-top {
position: fixed; position: fixed;
bottom: 20px; bottom: 20px;
right: 20px; right: 20px;
background: rgb(0, 0, 0); background: rgb(0, 0, 0);
background: rgba(0, 0, 0, 0.7); background: rgba(0, 0, 0, 0.7);
width: 50px; width: 50px;
height: 50px; height: 50px;
display: block; display: block;
text-decoration: none; text-decoration: none;
-webkit-border-radius: 35px; -webkit-border-radius: 35px;
-moz-border-radius: 35px; -moz-border-radius: 35px;
border-radius: 35px; border-radius: 35px;
display: none; display: none;
-webkit-transition: all 0.3s linear; -webkit-transition: all 0.3s linear;
-moz-transition: all 0.3s ease; -moz-transition: all 0.3s ease;
-ms-transition: all 0.3s ease; -ms-transition: all 0.3s ease;
-o-transition: all 0.3s ease; -o-transition: all 0.3s ease;
transition: all 0.3s ease; transition: all 0.3s ease;
} }
.return-to-top i { .return-to-top i {
color: #fff; color: #fff;
margin: 0; margin: 0;
position: relative; position: relative;
left: 16px; left: 16px;
top: 13px; top: 13px;
font-size: 19px; font-size: 19px;
-webkit-transition: all 0.3s ease; -webkit-transition: all 0.3s ease;
-moz-transition: all 0.3s ease; -moz-transition: all 0.3s ease;
-ms-transition: all 0.3s ease; -ms-transition: all 0.3s ease;
-o-transition: all 0.3s ease; -o-transition: all 0.3s ease;
transition: all 0.3s ease; transition: all 0.3s ease;
} }
.return-to-top:hover { .return-to-top:hover {
background: rgba(0, 0, 0, 0.9); background: rgba(0, 0, 0, 0.9);
} }
.return-to-top:hover i { .return-to-top:hover i {
color: #fff; color: #fff;
top: 5px; top: 5px;
} }
.footcustom{ .footcustom{
} }
#toTop img { #toTop img {
width: 50px; width: 50px;
} }
#toTop img:hover { #toTop img:hover {
cursor: pointer; cursor: pointer;
} }
.move { .move {
top: -60px; top: -60px;
} }
.movetext { .movetext {
top: -30px; top: -30px;
} }
/////// ///////
h1 { h1 {
margin-bottom: 15px margin-bottom: 15px
} }
h6{ h6{
width: 100%; width: 100%;
height: 100%; height: 100%;
background-position: center; background-position: center;
-webkit-background-size: cover; -webkit-background-size: cover;
-moz-background-size: cover; -moz-background-size: cover;
background-size: cover; background-size: cover;
-o-background-size: cover; -o-background-size: cover;
} }
h5{ h5{
padding-top: 40px; padding-top: 40px;
} }
.index-page--subtitle { .index-page--subtitle {
font-size: 16px; font-size: 16px;
line-height: 24px; line-height: 24px;
margin: 0 0 30px; margin: 0 0 30px;
} }
.form-horizontal button.btn-inverse { .form-horizontal button.btn-inverse {
margin-left: 32px; margin-left: 32px;
} }
#job-params-modal .modal-dialog { #job-params-modal .modal-dialog {
width: 100%; width: 100%;
//margin-left:auto; //margin-left:auto;
//margin-right:auto; //margin-right:auto;
} }
[ng-cloak].splash { [ng-cloak].splash {
display: block !important; display: block !important;
} }
[ng-cloak] { [ng-cloak] {
display: none; display: none;
} }
.splash { .splash {
background: @spring-green; background: @spring-green;
color: @spring-brown; color: @spring-brown;
display: none; display: none;
} }
.error-page { .error-page {
margin-top: 100px; margin-top: 100px;
text-align: center; text-align: center;
} }
.error-page .error-title { .error-page .error-title {
font-size: 24px; font-size: 24px;
line-height: 24px; line-height: 24px;
margin: 30px 0 0; margin: 30px 0 0;
} }
table td { table td {
vertical-align: middle; vertical-align: middle;
} }
table td .progress { table td .progress {
margin-bottom: 0; margin-bottom: 0;
} }
table td.action-column { table td.action-column {
width: 1px; width: 1px;
} }
.help-block { .help-block {
color: lighten(@text-color, 50%); // lighten the text some for contrast color: lighten(@text-color, 50%); // lighten the text some for contrast
} }
//.glyphicon { //.glyphicon {
// font-size: 20px; // font-size: 20px;
//} //}
.container-fluid{ .container-fluid{
width: 100%; width: 100%;
height:100%; height:100%;
margin-top: 25px; margin-top: 25px;
padding-left:0px; padding-left:0px;
padding-right:0px; padding-right:0px;
//margin-right:-500px; //margin-right:-500px;
//margin-left:-30px; //margin-left:-30px;
} }
//.navbar.navbar-default .nav-collapse { background-color: #f8f8f8; border-color: #080808; } //.navbar.navbar-default .nav-collapse { background-color: #f8f8f8; border-color: #080808; }
.navbar.navbar-inverse .nav-collapse { background-color: #222; border-color: #080808; z-index: 2; } .navbar.navbar-inverse .nav-collapse { background-color: #222; border-color: #080808; z-index: 2; }
.navbar-right {width: 100%; .navbar-right {width: 100%;
margin-right:0px;} margin-right:0px;}
.xd-containers { .xd-containers {
font-size: 15px; font-size: 15px;
width: 100%; width: 100%;
} }
.cluster-view > table td { .cluster-view > table td {
vertical-align: top; vertical-align: top;
} }
.cluster-view .label, .cluster-view .column-block { .cluster-view .label, .cluster-view .column-block {
display: block; display: block;
} }
.cluster-view .input-group-addon { .cluster-view .input-group-addon {
width: 0%; width: 0%;
} }
.cluster-view { .cluster-view {
margin-bottom: 0; margin-bottom: 0;
} }
.deployment-status-deployed { .deployment-status-deployed {
.label-success; .label-success;
} }
.deployment-status-incomplete { .deployment-status-incomplete {
.label-warning; .label-warning;
} }
.deployment-status-failed { .deployment-status-failed {
.label-danger; .label-danger;
} }
.deployment-status-deploying { .deployment-status-deploying {
.label-info .label-info
} }
.deployment-status-na { .deployment-status-na {
} }
.container-details-table th { .container-details-table th {
background-color: lighten(@spring-brown, 3%); background-color: lighten(@spring-brown, 3%);
color: @spring-light-grey; color: @spring-light-grey;
} }
.status-help-content-table td { .status-help-content-table td {
color: @spring-brown; color: @spring-brown;
} }
.alert-success { .alert-success {
.alert-variant(fade(@alert-success-bg, 70%); @alert-success-border; @alert-success-text); .alert-variant(fade(@alert-success-bg, 70%); @alert-success-border; @alert-success-text);
} }
.alert-info { .alert-info {
.alert-variant(fade(@alert-info-bg, 70%); @alert-info-border; @alert-info-text); .alert-variant(fade(@alert-info-bg, 70%); @alert-info-border; @alert-info-text);
} }
.alert-warning { .alert-warning {
.alert-variant(fade(@alert-warning-bg, 70%); @alert-warning-border; @alert-warning-text); .alert-variant(fade(@alert-warning-bg, 70%); @alert-warning-border; @alert-warning-text);
} }
.alert-danger { .alert-danger {
.alert-variant(fade(@alert-danger-bg, 70%); @alert-danger-border; @alert-danger-text); .alert-variant(fade(@alert-danger-bg, 70%); @alert-danger-border; @alert-danger-text);
} }
.myspinner { .myspinner {
animation-name: spinner; animation-name: spinner;
animation-duration: 2s; animation-duration: 2s;
animation-iteration-count: infinite; animation-iteration-count: infinite;
animation-timing-function: linear; animation-timing-function: linear;
-webkit-transform-origin: 49% 50%; -webkit-transform-origin: 49% 50%;
-webkit-animation-name: spinner; -webkit-animation-name: spinner;
-webkit-animation-duration: 2s; -webkit-animation-duration: 2s;
-webkit-animation-iteration-count: infinite; -webkit-animation-iteration-count: infinite;
-webkit-animation-timing-function: linear; -webkit-animation-timing-function: linear;
} }
hr { hr {
border-top: 1px dotted @spring-brown; border-top: 1px dotted @spring-brown;
} }
@import "typography.less"; @import "typography.less";
@import "header.less"; @import "header.less";
@import "responsive.less"; @import "responsive.less";

View file

@ -1,49 +1,49 @@
@media (max-width: 768px) { @media (max-width: 768px) {
.navbar-toggle { .navbar-toggle {
position:absolute; position:absolute;
z-index: 9999; z-index: 9999;
left:0px; left:0px;
top:0px; top:0px;
} }
.navbar-collapse {width:100%} .navbar-collapse {width:100%}
.navbar a.navbar-brand { .navbar a.navbar-brand {
display: block; display: block;
margin: 0 auto 0 auto; margin: 0 auto 0 auto;
width: 148px; width: 148px;
height: 50px; height: 50px;
float: none; float: none;
background: url("../images/spring-logo-dataflow-mobile.png") 0 center no-repeat; background: url("../images/spring-logo-dataflow-mobile.png") 0 center no-repeat;
} }
.homepage-billboard .homepage-subtitle { .homepage-billboard .homepage-subtitle {
font-size: 21px; font-size: 21px;
line-height: 21px; line-height: 21px;
} }
.floating-custom .floating-custom
{ {
margin-right:auto; margin-right:auto;
margin-left:auto; margin-left:auto;
text-align:center; text-align:center;
position:fixed; position:fixed;
} }
.navbar a.navbar-brand span { .navbar a.navbar-brand span {
display: none; display: none;
} }
.navbar { .navbar {
border-top-width: 0; border-top-width: 0;
} }
.xd-container { .xd-container {
margin-top: 20px; margin-top: 20px;
//margin-bottom: 30px; //margin-bottom: 30px;
} }
.index-page--subtitle { .index-page--subtitle {
margin-top: 10px; margin-top: 10px;
margin-bottom: 30px; margin-bottom: 30px;
} }
} }

View file

@ -1,60 +1,60 @@
@font-face { @font-face {
font-family: 'varela_roundregular'; font-family: 'varela_roundregular';
src: url('../fonts/varela_round-webfont.eot'); src: url('../fonts/varela_round-webfont.eot');
src: url('../fonts/varela_round-webfont.eot?#iefix') format('embedded-opentype'), src: url('../fonts/varela_round-webfont.eot?#iefix') format('embedded-opentype'),
url('../fonts/varela_round-webfont.woff') format('woff'), url('../fonts/varela_round-webfont.woff') format('woff'),
url('../fonts/varela_round-webfont.ttf') format('truetype'), url('../fonts/varela_round-webfont.ttf') format('truetype'),
url('../fonts/varela_round-webfont.svg#varela_roundregular') format('svg'); url('../fonts/varela_round-webfont.svg#varela_roundregular') format('svg');
font-weight: normal; font-weight: normal;
font-style: normal; font-style: normal;
} }
@font-face { @font-face {
font-family: 'montserratregular'; font-family: 'montserratregular';
src: url('../fonts/montserrat-webfont.eot'); src: url('../fonts/montserrat-webfont.eot');
src: url('../fonts/montserrat-webfont.eot?#iefix') format('embedded-opentype'), src: url('../fonts/montserrat-webfont.eot?#iefix') format('embedded-opentype'),
url('../fonts/montserrat-webfont.woff') format('woff'), url('../fonts/montserrat-webfont.woff') format('woff'),
url('../fonts/montserrat-webfont.ttf') format('truetype'), url('../fonts/montserrat-webfont.ttf') format('truetype'),
url('../fonts/montserrat-webfont.svg#montserratregular') format('svg'); url('../fonts/montserrat-webfont.svg#montserratregular') format('svg');
font-weight: normal; font-weight: normal;
font-style: normal; font-style: normal;
} }
body, h1, h2, h3, p, input { body, h1, h2, h3, p, input {
margin: 0; margin: 0;
font-weight: 400; font-weight: 400;
font-family: "Bookman Old Style"; font-family: "Bookman Old Style";
color: #0000; color: #0000;
} }
h1 { h1 {
font-size: 24px; font-size: 24px;
line-height: 30px; line-height: 30px;
font-family: "montserratregular", sans-serif; font-family: "montserratregular", sans-serif;
} }
h2 { h2 {
font-size: 18px; font-size: 18px;
font-weight: 700; font-weight: 700;
line-height: 24px; line-height: 24px;
margin-bottom: 10px; margin-bottom: 10px;
font-family: "montserratregular", sans-serif; font-family: "montserratregular", sans-serif;
} }
h3 { h3 {
font-size: 16px; font-size: 16px;
line-height: 24px; line-height: 24px;
margin-bottom: 10px; margin-bottom: 10px;
font-weight: 700; font-weight: 700;
} }
p { p {
//font-size: 15px; //font-size: 15px;
//line-height: 24px; //line-height: 24px;
} }
strong { strong {
font-weight: 700; font-weight: 700;
font-family: "montserratregular", sans-serif; font-family: "montserratregular", sans-serif;
} }

View file

@ -1,7 +1,7 @@
# database init, supports mysql too # database init, supports mysql too
database=mysql database=mysql
spring.datasource.url=jdbc:mysql://localhost/test spring.datasource.url=jdbc:mysql://localhost/test
spring.datasource.username=root spring.datasource.username=root
spring.datasource.password=root spring.datasource.password=root
# Uncomment this the first time the app runs # Uncomment this the first time the app runs
# spring.datasource.initialize=true # spring.datasource.initialize=true

View file

@ -1,26 +1,26 @@
# database init, supports mysql too # database init, supports mysql too
database=hsqldb database=hsqldb
spring.datasource.schema=classpath*:db/${database}/schema.sql spring.datasource.schema=classpath*:db/${database}/schema.sql
spring.datasource.data=classpath*:db/${database}/data.sql spring.datasource.data=classpath*:db/${database}/data.sql
# Web # Web
spring.thymeleaf.mode=HTML spring.thymeleaf.mode=HTML
# JPA # JPA
spring.jpa.hibernate.ddl-auto=none spring.jpa.hibernate.ddl-auto=none
# Internationalization # Internationalization
spring.messages.basename=messages/messages spring.messages.basename=messages/messages
# Actuator / Management # Actuator / Management
management.contextPath=/manage management.contextPath=/manage
# Spring Boot 1.5 makes actuator secure by default # Spring Boot 1.5 makes actuator secure by default
management.security.enabled=false management.security.enabled=false
# Logging # Logging
logging.level.org.springframework=INFO logging.level.org.springframework=INFO
# logging.level.org.springframework.web=DEBUG # logging.level.org.springframework.web=DEBUG
# logging.level.org.springframework.context.annotation=TRACE # logging.level.org.springframework.context.annotation=TRACE
# Active Spring profiles # Active Spring profiles
spring.profiles.active=production spring.profiles.active=production

View file

@ -1,15 +1,15 @@
|\ _,,,--,,_ |\ _,,,--,,_
/,`.-'`' ._ \-;;,_ /,`.-'`' ._ \-;;,_
_______ __|,4- ) )_ .;.(__`'-'__ ___ __ _ ___ _______ _______ __|,4- ) )_ .;.(__`'-'__ ___ __ _ ___ _______
| | '---''(_/._)-'(_\_) | | | | | | | | | | | '---''(_/._)-'(_\_) | | | | | | | | |
| _ | ___|_ _| | | | | |_| | | | __ _ _ | _ | ___|_ _| | | | | |_| | | | __ _ _
| |_| | |___ | | | | | | | | | | \ \ \ \ | |_| | |___ | | | | | | | | | | \ \ \ \
| ___| ___| | | | _| |___| | _ | | _| \ \ \ \ | ___| ___| | | | _| |___| | _ | | _| \ \ \ \
| | | |___ | | | |_| | | | | | | |_ ) ) ) ) | | | |___ | | | |_| | | | | | | |_ ) ) ) )
|___| |_______| |___| |_______|_______|___|_| |__|___|_______| / / / / |___| |_______| |___| |_______|_______|___|_| |__|___|_______| / / / /
==================================================================/_/_/_/ ==================================================================/_/_/_/
:: Built with Spring Boot :: ${spring-boot.version} :: Built with Spring Boot :: ${spring-boot.version}

View file

@ -1,50 +1,50 @@
INSERT INTO doctors VALUES (1, 'James', 'Carter'); INSERT INTO doctors VALUES (1, 'James', 'Carter');
INSERT INTO doctors VALUES (2, 'Helen', 'Leary'); INSERT INTO doctors VALUES (2, 'Helen', 'Leary');
INSERT INTO doctors VALUES (3, 'Linda', 'Douglas'); INSERT INTO doctors VALUES (3, 'Linda', 'Douglas');
INSERT INTO doctors VALUES (4, 'Rafael', 'Ortega'); INSERT INTO doctors VALUES (4, 'Rafael', 'Ortega');
INSERT INTO doctors VALUES (5, 'Henry', 'Stevens'); INSERT INTO doctors VALUES (5, 'Henry', 'Stevens');
INSERT INTO doctors VALUES (6, 'Sharon', 'Jenkins'); INSERT INTO doctors VALUES (6, 'Sharon', 'Jenkins');
INSERT INTO specialties VALUES (1, 'radiology'); INSERT INTO specialties VALUES (1, 'radiology');
INSERT INTO specialties VALUES (2, 'surgery'); INSERT INTO specialties VALUES (2, 'surgery');
INSERT INTO specialties VALUES (3, 'dentistry'); INSERT INTO specialties VALUES (3, 'dentistry');
INSERT INTO doctor_specialties VALUES (2, 1); INSERT INTO doctor_specialties VALUES (2, 1);
INSERT INTO doctor_specialties VALUES (3, 2); INSERT INTO doctor_specialties VALUES (3, 2);
INSERT INTO doctor_specialties VALUES (3, 3); INSERT INTO doctor_specialties VALUES (3, 3);
INSERT INTO doctor_specialties VALUES (4, 2); INSERT INTO doctor_specialties VALUES (4, 2);
INSERT INTO doctor_specialties VALUES (5, 1); INSERT INTO doctor_specialties VALUES (5, 1);
INSERT INTO gender VALUES (1, 'male'); INSERT INTO gender VALUES (1, 'male');
INSERT INTO gender VALUES (2, 'female'); INSERT INTO gender VALUES (2, 'female');
INSERT INTO parents VALUES (1, 'George', 'Franklin', '110 W. Liberty St.', 'Madison', '6085551023'); INSERT INTO parents VALUES (1, 'George', 'Franklin', '110 W. Liberty St.', 'Madison', '6085551023');
INSERT INTO parents VALUES (2, 'Betty', 'Davis', '638 Cardinal Ave.', 'Sun Prairie', '6085551749'); INSERT INTO parents VALUES (2, 'Betty', 'Davis', '638 Cardinal Ave.', 'Sun Prairie', '6085551749');
INSERT INTO parents VALUES (3, 'Eduardo', 'Rodriquez', '2693 Commerce St.', 'McFarland', '6085558763'); INSERT INTO parents VALUES (3, 'Eduardo', 'Rodriquez', '2693 Commerce St.', 'McFarland', '6085558763');
INSERT INTO parents VALUES (4, 'Harold', 'Davis', '563 Friendly St.', 'Windsor', '6085553198'); INSERT INTO parents VALUES (4, 'Harold', 'Davis', '563 Friendly St.', 'Windsor', '6085553198');
INSERT INTO parents VALUES (5, 'Peter', 'McTavish', '2387 S. Fair Way', 'Madison', '6085552765'); INSERT INTO parents VALUES (5, 'Peter', 'McTavish', '2387 S. Fair Way', 'Madison', '6085552765');
INSERT INTO parents VALUES (6, 'Jean', 'Coleman', '105 N. Lake St.', 'Monona', '6085552654'); INSERT INTO parents VALUES (6, 'Jean', 'Coleman', '105 N. Lake St.', 'Monona', '6085552654');
INSERT INTO parents VALUES (7, 'Jeff', 'Black', '1450 Oak Blvd.', 'Monona', '6085555387'); INSERT INTO parents VALUES (7, 'Jeff', 'Black', '1450 Oak Blvd.', 'Monona', '6085555387');
INSERT INTO parents VALUES (8, 'Maria', 'Escobito', '345 Maple St.', 'Madison', '6085557683'); INSERT INTO parents VALUES (8, 'Maria', 'Escobito', '345 Maple St.', 'Madison', '6085557683');
INSERT INTO parents VALUES (9, 'David', 'Schroeder', '2749 Blackhawk Trail', 'Madison', '6085559435'); INSERT INTO parents VALUES (9, 'David', 'Schroeder', '2749 Blackhawk Trail', 'Madison', '6085559435');
INSERT INTO parents VALUES (10, 'Carlos', 'Estaban', '2335 Independence La.', 'Waunakee', '6085555487'); INSERT INTO parents VALUES (10, 'Carlos', 'Estaban', '2335 Independence La.', 'Waunakee', '6085555487');
INSERT INTO kids VALUES (1, 'Alyssa', '2000-09-07', 2, 1); INSERT INTO kids VALUES (1, 'Alyssa', '2000-09-07', 2, 1);
INSERT INTO kids VALUES (2, 'Joe', '2002-08-06', 1, 2); INSERT INTO kids VALUES (2, 'Joe', '2002-08-06', 1, 2);
INSERT INTO kids VALUES (3, 'Lauren', '2001-04-17', 2, 3); INSERT INTO kids VALUES (3, 'Lauren', '2001-04-17', 2, 3);
INSERT INTO kids VALUES (4, 'Nicole', '2000-03-07', 2, 3); INSERT INTO kids VALUES (4, 'Nicole', '2000-03-07', 2, 3);
INSERT INTO kids VALUES (5, 'Thomas', '2000-11-30', 1, 4); INSERT INTO kids VALUES (5, 'Thomas', '2000-11-30', 1, 4);
INSERT INTO kids VALUES (6, 'Samantha', '2000-01-20', 2, 5); INSERT INTO kids VALUES (6, 'Samantha', '2000-01-20', 2, 5);
INSERT INTO kids VALUES (7, 'George', '1995-09-04', 1, 6); INSERT INTO kids VALUES (7, 'George', '1995-09-04', 1, 6);
INSERT INTO kids VALUES (8, 'Max', '1995-09-04', 1, 6); INSERT INTO kids VALUES (8, 'Max', '1995-09-04', 1, 6);
INSERT INTO kids VALUES (9, 'Brendan', '1999-08-06', 1, 7); INSERT INTO kids VALUES (9, 'Brendan', '1999-08-06', 1, 7);
INSERT INTO kids VALUES (10, 'Elizabeth', '1997-02-24', 2, 8); INSERT INTO kids VALUES (10, 'Elizabeth', '1997-02-24', 2, 8);
INSERT INTO kids VALUES (11, 'Lucy', '2000-03-09', 2, 9); INSERT INTO kids VALUES (11, 'Lucy', '2000-03-09', 2, 9);
INSERT INTO kids VALUES (12, 'Sunny', '2000-06-24', 2, 10); INSERT INTO kids VALUES (12, 'Sunny', '2000-06-24', 2, 10);
INSERT INTO kids VALUES (13, 'Conner', '2002-06-08', 1, 10); INSERT INTO kids VALUES (13, 'Conner', '2002-06-08', 1, 10);
INSERT INTO visits VALUES (1, 7, '2013-01-01', 'rabies shot'); INSERT INTO visits VALUES (1, 7, '2013-01-01', 'rabies shot');
INSERT INTO visits VALUES (2, 8, '2013-01-02', 'rabies shot'); INSERT INTO visits VALUES (2, 8, '2013-01-02', 'rabies shot');
INSERT INTO visits VALUES (3, 8, '2013-01-03', 'cold'); INSERT INTO visits VALUES (3, 8, '2013-01-03', 'cold');
INSERT INTO visits VALUES (4, 7, '2013-01-04', 'flu'); INSERT INTO visits VALUES (4, 7, '2013-01-04', 'flu');

View file

@ -1,64 +1,64 @@
DROP TABLE doctor_specialties IF EXISTS; DROP TABLE doctor_specialties IF EXISTS;
DROP TABLE doctors IF EXISTS; DROP TABLE doctors IF EXISTS;
DROP TABLE specialties IF EXISTS; DROP TABLE specialties IF EXISTS;
DROP TABLE visits IF EXISTS; DROP TABLE visits IF EXISTS;
DROP TABLE kids IF EXISTS; DROP TABLE kids IF EXISTS;
DROP TABLE gender IF EXISTS; DROP TABLE gender IF EXISTS;
DROP TABLE parents IF EXISTS; DROP TABLE parents IF EXISTS;
CREATE TABLE doctors ( CREATE TABLE doctors (
id INTEGER IDENTITY PRIMARY KEY, id INTEGER IDENTITY PRIMARY KEY,
first_name VARCHAR(30), first_name VARCHAR(30),
last_name VARCHAR(30) last_name VARCHAR(30)
); );
CREATE INDEX doctors_last_name ON doctors (last_name); CREATE INDEX doctors_last_name ON doctors (last_name);
CREATE TABLE specialties ( CREATE TABLE specialties (
id INTEGER IDENTITY PRIMARY KEY, id INTEGER IDENTITY PRIMARY KEY,
name VARCHAR(80) name VARCHAR(80)
); );
CREATE INDEX specialties_name ON specialties (name); CREATE INDEX specialties_name ON specialties (name);
CREATE TABLE doctor_specialties ( CREATE TABLE doctor_specialties (
doctor_id INTEGER NOT NULL, doctor_id INTEGER NOT NULL,
specialty_id INTEGER NOT NULL specialty_id INTEGER NOT NULL
); );
ALTER TABLE doctor_specialties ADD CONSTRAINT fk_doctor_specialties_doctors FOREIGN KEY (doctor_id) REFERENCES doctors (id); ALTER TABLE doctor_specialties ADD CONSTRAINT fk_doctor_specialties_doctors FOREIGN KEY (doctor_id) REFERENCES doctors (id);
ALTER TABLE doctor_specialties ADD CONSTRAINT fk_doctor_specialties_specialties FOREIGN KEY (specialty_id) REFERENCES specialties (id); ALTER TABLE doctor_specialties ADD CONSTRAINT fk_doctor_specialties_specialties FOREIGN KEY (specialty_id) REFERENCES specialties (id);
CREATE TABLE gender ( CREATE TABLE gender (
id INTEGER IDENTITY PRIMARY KEY, id INTEGER IDENTITY PRIMARY KEY,
name VARCHAR(80) name VARCHAR(80)
); );
CREATE INDEX gender_name ON gender (name); CREATE INDEX gender_name ON gender (name);
CREATE TABLE parents ( CREATE TABLE parents (
id INTEGER IDENTITY PRIMARY KEY, id INTEGER IDENTITY PRIMARY KEY,
first_name VARCHAR(30), first_name VARCHAR(30),
last_name VARCHAR_IGNORECASE(30), last_name VARCHAR_IGNORECASE(30),
address VARCHAR(255), address VARCHAR(255),
city VARCHAR(80), city VARCHAR(80),
telephone VARCHAR(20) telephone VARCHAR(20)
); );
CREATE INDEX parents_last_name ON parents (last_name); CREATE INDEX parents_last_name ON parents (last_name);
CREATE TABLE kids ( CREATE TABLE kids (
id INTEGER IDENTITY PRIMARY KEY, id INTEGER IDENTITY PRIMARY KEY,
name VARCHAR(30), name VARCHAR(30),
birth_date DATE, birth_date DATE,
gender_id INTEGER NOT NULL, gender_id INTEGER NOT NULL,
parent_id INTEGER NOT NULL parent_id INTEGER NOT NULL
); );
ALTER TABLE kids ADD CONSTRAINT fk_kids_parents FOREIGN KEY (parent_id) REFERENCES parents (id); ALTER TABLE kids ADD CONSTRAINT fk_kids_parents FOREIGN KEY (parent_id) REFERENCES parents (id);
ALTER TABLE kids ADD CONSTRAINT fk_kids_gender FOREIGN KEY (gender_id) REFERENCES gender (id); ALTER TABLE kids ADD CONSTRAINT fk_kids_gender FOREIGN KEY (gender_id) REFERENCES gender (id);
CREATE INDEX kids_name ON kids (name); CREATE INDEX kids_name ON kids (name);
CREATE TABLE visits ( CREATE TABLE visits (
id INTEGER IDENTITY PRIMARY KEY, id INTEGER IDENTITY PRIMARY KEY,
kid_id INTEGER NOT NULL, kid_id INTEGER NOT NULL,
visit_date DATE, visit_date DATE,
description VARCHAR(255) description VARCHAR(255)
); );
ALTER TABLE visits ADD CONSTRAINT fk_visits_kids FOREIGN KEY (kid_id) REFERENCES kids (id); ALTER TABLE visits ADD CONSTRAINT fk_visits_kids FOREIGN KEY (kid_id) REFERENCES kids (id);
CREATE INDEX visits_kid_id ON visits (kid_id); CREATE INDEX visits_kid_id ON visits (kid_id);

View file

@ -1,49 +1,49 @@
INSERT IGNORE INTO doctors VALUES (1, 'James', 'Carter'); INSERT IGNORE INTO doctors VALUES (1, 'James', 'Carter');
INSERT IGNORE INTO doctors VALUES (2, 'Helen', 'Leary'); INSERT IGNORE INTO doctors VALUES (2, 'Helen', 'Leary');
INSERT IGNORE INTO doctors VALUES (3, 'Linda', 'Douglas'); INSERT IGNORE INTO doctors VALUES (3, 'Linda', 'Douglas');
INSERT IGNORE INTO doctors VALUES (4, 'Rafael', 'Ortega'); INSERT IGNORE INTO doctors VALUES (4, 'Rafael', 'Ortega');
INSERT IGNORE INTO doctors VALUES (5, 'Henry', 'Stevens'); INSERT IGNORE INTO doctors VALUES (5, 'Henry', 'Stevens');
INSERT IGNORE INTO doctors VALUES (6, 'Sharon', 'Jenkins'); INSERT IGNORE INTO doctors VALUES (6, 'Sharon', 'Jenkins');
INSERT IGNORE INTO specialties VALUES (1, 'radiology'); INSERT IGNORE INTO specialties VALUES (1, 'radiology');
INSERT IGNORE INTO specialties VALUES (2, 'surgery'); INSERT IGNORE INTO specialties VALUES (2, 'surgery');
INSERT IGNORE INTO specialties VALUES (3, 'dentistry'); INSERT IGNORE INTO specialties VALUES (3, 'dentistry');
INSERT IGNORE INTO doctor_specialties VALUES (2, 1); INSERT IGNORE INTO doctor_specialties VALUES (2, 1);
INSERT IGNORE INTO doctor_specialties VALUES (3, 2); INSERT IGNORE INTO doctor_specialties VALUES (3, 2);
INSERT IGNORE INTO doctor_specialties VALUES (3, 3); INSERT IGNORE INTO doctor_specialties VALUES (3, 3);
INSERT IGNORE INTO doctor_specialties VALUES (4, 2); INSERT IGNORE INTO doctor_specialties VALUES (4, 2);
INSERT IGNORE INTO doctor_specialties VALUES (5, 1); INSERT IGNORE INTO doctor_specialties VALUES (5, 1);
INSERT IGNORE INTO gender VALUES (1, 'male'); INSERT IGNORE INTO gender VALUES (1, 'male');
INSERT IGNORE INTO gender VALUES (2, 'female'); INSERT IGNORE INTO gender VALUES (2, 'female');
INSERT IGNORE INTO parents VALUES (1, 'George', 'Franklin', '110 W. Liberty St.', 'Madison', '6085551023'); INSERT IGNORE INTO parents VALUES (1, 'George', 'Franklin', '110 W. Liberty St.', 'Madison', '6085551023');
INSERT IGNORE INTO parents VALUES (2, 'Betty', 'Davis', '638 Cardinal Ave.', 'Sun Prairie', '6085551749'); INSERT IGNORE INTO parents VALUES (2, 'Betty', 'Davis', '638 Cardinal Ave.', 'Sun Prairie', '6085551749');
INSERT IGNORE INTO parents VALUES (3, 'Eduardo', 'Rodriquez', '2693 Commerce St.', 'McFarland', '6085558763'); INSERT IGNORE INTO parents VALUES (3, 'Eduardo', 'Rodriquez', '2693 Commerce St.', 'McFarland', '6085558763');
INSERT IGNORE INTO parents VALUES (4, 'Harold', 'Davis', '563 Friendly St.', 'Windsor', '6085553198'); INSERT IGNORE INTO parents VALUES (4, 'Harold', 'Davis', '563 Friendly St.', 'Windsor', '6085553198');
INSERT IGNORE INTO parents VALUES (5, 'Peter', 'McTavish', '2387 S. Fair Way', 'Madison', '6085552765'); INSERT IGNORE INTO parents VALUES (5, 'Peter', 'McTavish', '2387 S. Fair Way', 'Madison', '6085552765');
INSERT IGNORE INTO parents VALUES (6, 'Jean', 'Coleman', '105 N. Lake St.', 'Monona', '6085552654'); INSERT IGNORE INTO parents VALUES (6, 'Jean', 'Coleman', '105 N. Lake St.', 'Monona', '6085552654');
INSERT IGNORE INTO parents VALUES (7, 'Jeff', 'Black', '1450 Oak Blvd.', 'Monona', '6085555387'); INSERT IGNORE INTO parents VALUES (7, 'Jeff', 'Black', '1450 Oak Blvd.', 'Monona', '6085555387');
INSERT IGNORE INTO parents VALUES (8, 'Maria', 'Escobito', '345 Maple St.', 'Madison', '6085557683'); INSERT IGNORE INTO parents VALUES (8, 'Maria', 'Escobito', '345 Maple St.', 'Madison', '6085557683');
INSERT IGNORE INTO parents VALUES (9, 'David', 'Schroeder', '2749 Blackhawk Trail', 'Madison', '6085559435'); INSERT IGNORE INTO parents VALUES (9, 'David', 'Schroeder', '2749 Blackhawk Trail', 'Madison', '6085559435');
INSERT IGNORE INTO parents VALUES (10, 'Carlos', 'Estaban', '2335 Independence La.', 'Waunakee', '6085555487'); INSERT IGNORE INTO parents VALUES (10, 'Carlos', 'Estaban', '2335 Independence La.', 'Waunakee', '6085555487');
INSERT IGNORE INTO kids VALUES (1, 'Leo', '2000-09-07', 2, 1); INSERT IGNORE INTO kids VALUES (1, 'Leo', '2000-09-07', 2, 1);
INSERT IGNORE INTO kids VALUES (2, 'Basil', '2002-08-06', 1, 2); INSERT IGNORE INTO kids VALUES (2, 'Basil', '2002-08-06', 1, 2);
INSERT IGNORE INTO kids VALUES (3, 'Rosy', '2001-04-17', 2, 3); INSERT IGNORE INTO kids VALUES (3, 'Rosy', '2001-04-17', 2, 3);
INSERT IGNORE INTO kids VALUES (4, 'Jewel', '2000-03-07', 2, 3); INSERT IGNORE INTO kids VALUES (4, 'Jewel', '2000-03-07', 2, 3);
INSERT IGNORE INTO kids VALUES (5, 'Iggy', '2000-11-30', 1, 4); INSERT IGNORE INTO kids VALUES (5, 'Iggy', '2000-11-30', 1, 4);
INSERT IGNORE INTO kids VALUES (6, 'George', '2000-01-20', 2, 5); INSERT IGNORE INTO kids VALUES (6, 'George', '2000-01-20', 2, 5);
INSERT IGNORE INTO kids VALUES (7, 'Samantha', '1995-09-04', 1, 6); INSERT IGNORE INTO kids VALUES (7, 'Samantha', '1995-09-04', 1, 6);
INSERT IGNORE INTO kids VALUES (8, 'Max', '1995-09-04', 1, 6); INSERT IGNORE INTO kids VALUES (8, 'Max', '1995-09-04', 1, 6);
INSERT IGNORE INTO kids VALUES (9, 'Lucky', '1999-08-06', 1, 7); INSERT IGNORE INTO kids VALUES (9, 'Lucky', '1999-08-06', 1, 7);
INSERT IGNORE INTO kids VALUES (10, 'Mulligan', '1997-02-24', 2, 8); INSERT IGNORE INTO kids VALUES (10, 'Mulligan', '1997-02-24', 2, 8);
INSERT IGNORE INTO kids VALUES (11, 'Freddy', '2000-03-09', 2, 9); INSERT IGNORE INTO kids VALUES (11, 'Freddy', '2000-03-09', 2, 9);
INSERT IGNORE INTO kids VALUES (12, 'Lucky', '2000-06-24', 2, 10); INSERT IGNORE INTO kids VALUES (12, 'Lucky', '2000-06-24', 2, 10);
INSERT IGNORE INTO kids VALUES (13, 'Sly', '2002-06-08', 1, 10); INSERT IGNORE INTO kids VALUES (13, 'Sly', '2002-06-08', 1, 10);
INSERT IGNORE INTO visits VALUES (1, 7, '2010-03-04', 'rabies shot'); INSERT IGNORE INTO visits VALUES (1, 7, '2010-03-04', 'rabies shot');
INSERT IGNORE INTO visits VALUES (2, 8, '2011-03-04', 'rabies shot'); INSERT IGNORE INTO visits VALUES (2, 8, '2011-03-04', 'rabies shot');
INSERT IGNORE INTO visits VALUES (3, 8, '2009-06-04', 'neutered'); INSERT IGNORE INTO visits VALUES (3, 8, '2009-06-04', 'neutered');
INSERT IGNORE INTO visits VALUES (4, 7, '2008-09-04', 'spayed'); INSERT IGNORE INTO visits VALUES (4, 7, '2008-09-04', 'spayed');

View file

@ -1,17 +1,17 @@
================================================================================ ================================================================================
=== Spring PetClinic sample application - MySQL Configuration === === Spring PetClinic sample application - MySQL Configuration ===
================================================================================ ================================================================================
@author Sam Brannen @author Sam Brannen
@author Costin Leau @author Costin Leau
@author Dave Syer @author Dave Syer
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
1) Download and install the MySQL database (e.g., MySQL Community Server 5.1.x), 1) Download and install the MySQL database (e.g., MySQL Community Server 5.1.x),
which can be found here: http://dev.mysql.com/downloads/. Or run the which can be found here: http://dev.mysql.com/downloads/. Or run the
"docker-compose.yml" from the root of the project (if you have docker installed "docker-compose.yml" from the root of the project (if you have docker installed
locally). locally).
2) Create the PetClinic database and user by executing the "db/mysql/{schema,data}.sql" 2) Create the PetClinic database and user by executing the "db/mysql/{schema,data}.sql"
scripts (or set "spring.datasource.initialize=true" the first time you run the app). scripts (or set "spring.datasource.initialize=true" the first time you run the app).

View file

@ -1,65 +1,65 @@
CREATE DATABASE IF NOT EXISTS kidclinic; CREATE DATABASE IF NOT EXISTS kidclinic;
ALTER DATABASE kidclinic ALTER DATABASE kidclinic
DEFAULT CHARACTER SET utf8 DEFAULT CHARACTER SET utf8
DEFAULT COLLATE utf8_general_ci; DEFAULT COLLATE utf8_general_ci;
GRANT ALL PRIVILEGES ON kidclinic.* TO pc@localhost IDENTIFIED BY 'pc'; GRANT ALL PRIVILEGES ON kidclinic.* TO pc@localhost IDENTIFIED BY 'pc';
USE kidclinic; USE kidclinic;
CREATE TABLE IF NOT EXISTS doctors ( CREATE TABLE IF NOT EXISTS doctors (
id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
first_name VARCHAR(30), first_name VARCHAR(30),
last_name VARCHAR(30), last_name VARCHAR(30),
INDEX(last_name) INDEX(last_name)
) engine=InnoDB; ) engine=InnoDB;
CREATE TABLE IF NOT EXISTS specialties ( CREATE TABLE IF NOT EXISTS specialties (
id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(80), name VARCHAR(80),
INDEX(name) INDEX(name)
) engine=InnoDB; ) engine=InnoDB;
CREATE TABLE IF NOT EXISTS doctor_specialties ( CREATE TABLE IF NOT EXISTS doctor_specialties (
doctor_id INT(4) UNSIGNED NOT NULL, doctor_id INT(4) UNSIGNED NOT NULL,
specialty_id INT(4) UNSIGNED NOT NULL, specialty_id INT(4) UNSIGNED NOT NULL,
FOREIGN KEY (doctor_id) REFERENCES doctors(id), FOREIGN KEY (doctor_id) REFERENCES doctors(id),
FOREIGN KEY (specialty_id) REFERENCES specialties(id), FOREIGN KEY (specialty_id) REFERENCES specialties(id),
UNIQUE (doctor_id,specialty_id) UNIQUE (doctor_id,specialty_id)
) engine=InnoDB; ) engine=InnoDB;
CREATE TABLE IF NOT EXISTS gender ( CREATE TABLE IF NOT EXISTS gender (
id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(80), name VARCHAR(80),
INDEX(name) INDEX(name)
) engine=InnoDB; ) engine=InnoDB;
CREATE TABLE IF NOT EXISTS parents ( CREATE TABLE IF NOT EXISTS parents (
id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
first_name VARCHAR(30), first_name VARCHAR(30),
last_name VARCHAR(30), last_name VARCHAR(30),
address VARCHAR(255), address VARCHAR(255),
city VARCHAR(80), city VARCHAR(80),
telephone VARCHAR(20), telephone VARCHAR(20),
INDEX(last_name) INDEX(last_name)
) engine=InnoDB; ) engine=InnoDB;
CREATE TABLE IF NOT EXISTS kids ( CREATE TABLE IF NOT EXISTS kids (
id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(30), name VARCHAR(30),
birth_date DATE, birth_date DATE,
gender_id INT(4) UNSIGNED NOT NULL, gender_id INT(4) UNSIGNED NOT NULL,
parent_id INT(4) UNSIGNED NOT NULL, parent_id INT(4) UNSIGNED NOT NULL,
INDEX(name), INDEX(name),
FOREIGN KEY (parent_id) REFERENCES parents(id), FOREIGN KEY (parent_id) REFERENCES parents(id),
FOREIGN KEY (gender_id) REFERENCES gender(id) FOREIGN KEY (gender_id) REFERENCES gender(id)
) engine=InnoDB; ) engine=InnoDB;
CREATE TABLE IF NOT EXISTS visits ( CREATE TABLE IF NOT EXISTS visits (
id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
kid_id INT(4) UNSIGNED NOT NULL, kid_id INT(4) UNSIGNED NOT NULL,
visit_date DATE, visit_date DATE,
description VARCHAR(255), description VARCHAR(255),
FOREIGN KEY (kid_id) REFERENCES kids(id) FOREIGN KEY (kid_id) REFERENCES kids(id)
) engine=InnoDB; ) engine=InnoDB;

View file

@ -1,8 +1,8 @@
welcome=Welcome welcome=Welcome
required=is required required=is required
notFound=has not been found notFound=has not been found
duplicate=is already in use duplicate=is already in use
nonNumeric=must be all numeric nonNumeric=must be all numeric
duplicateFormSubmission=Duplicate form submission is not allowed duplicateFormSubmission=Duplicate form submission is not allowed
typeMismatch.date=invalid date typeMismatch.date=invalid date
typeMismatch.birthDate=invalid date typeMismatch.birthDate=invalid date

View file

@ -1,8 +1,8 @@
welcome=Willkommen welcome=Willkommen
required=muss angegeben werden required=muss angegeben werden
notFound=wurde nicht gefunden notFound=wurde nicht gefunden
duplicate=ist bereits vergeben duplicate=ist bereits vergeben
nonNumeric=darf nur numerisch sein nonNumeric=darf nur numerisch sein
duplicateFormSubmission=Wiederholtes Absenden des Formulars ist nicht erlaubt duplicateFormSubmission=Wiederholtes Absenden des Formulars ist nicht erlaubt
typeMismatch.date=ungültiges Datum typeMismatch.date=ungültiges Datum
typeMismatch.birthDate=ungültiges Datum typeMismatch.birthDate=ungültiges Datum

File diff suppressed because it is too large Load diff

Before

Width:  |  Height:  |  Size: 83 KiB

After

Width:  |  Height:  |  Size: 84 KiB

File diff suppressed because it is too large Load diff

Before

Width:  |  Height:  |  Size: 362 KiB

After

Width:  |  Height:  |  Size: 369 KiB

View file

@ -1,28 +1,28 @@
<!DOCTYPE html> <!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" <html xmlns:th="http://www.thymeleaf.org"
th:replace="~{fragments/layout :: layout (~{::body},'doctors')}"> th:replace="~{fragments/layout :: layout (~{::body},'doctors')}">
<body> <body>
<h2>Pediatricians</h2> <h2>Pediatricians</h2>
<table id="doctors" class="table table-striped"> <table id="doctors" class="table table-striped">
<thead> <thead>
<tr> <tr>
<th>Name</th> <th>Name</th>
<th>Specialties</th> <th>Specialties</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr th:each="doctor : ${doctors.doctorList}"> <tr th:each="doctor : ${doctors.doctorList}">
<td th:text="${doctor.firstName + ' ' + doctor.lastName}"></td> <td th:text="${doctor.firstName + ' ' + doctor.lastName}"></td>
<td><span th:each="specialty : ${doctor.specialties}" <td><span th:each="specialty : ${doctor.specialties}"
th:text="${specialty.name + ' '}" /> <span th:text="${specialty.name + ' '}" /> <span
th:if="${doctor.nrOfSpecialties == 0}">none</span></td> th:if="${doctor.nrOfSpecialties == 0}">none</span></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</body> </body>
</html> </html>

View file

@ -1,10 +1,10 @@
<!DOCTYPE html> <!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" th:replace="~{fragments/layout :: layout (~{::body},'error')}"> <html xmlns:th="http://www.thymeleaf.org" th:replace="~{fragments/layout :: layout (~{::body},'error')}">
<body> <body>
<h2>Errors</h2> <h2>Errors</h2>
<p th:text="${message}">Exception message</p> <p th:text="${message}">Exception message</p>
</body> </body>
</html> </html>

View file

@ -1,26 +1,26 @@
<html> <html>
<body> <body>
<form> <form>
<th:block th:fragment="input (label, name)"> <th:block th:fragment="input (label, name)">
<div th:with="valid=${!#fields.hasErrors(name)}" <div th:with="valid=${!#fields.hasErrors(name)}"
th:class="${'form-group' + (valid ? '' : ' has-error')}" th:class="${'form-group' + (valid ? '' : ' has-error')}"
class="form-group"> class="form-group">
<label class="col-sm-2 control-label" th:text="${label}">Label</label> <label class="col-sm-2 control-label" th:text="${label}">Label</label>
<div class="col-sm-10"> <div class="col-sm-10">
<input class="form-control" type="text" <input class="form-control" type="text"
th:field="*{__${name}__}" /> th:field="*{__${name}__}" />
<span th:if="${valid}" <span th:if="${valid}"
class="glyphicon glyphicon-ok form-control-feedback" class="glyphicon glyphicon-ok form-control-feedback"
aria-hidden="true"></span> aria-hidden="true"></span>
<th:block th:if="${!valid}"> <th:block th:if="${!valid}">
<span <span
class="glyphicon glyphicon-remove form-control-feedback" class="glyphicon glyphicon-remove form-control-feedback"
aria-hidden="true"></span> aria-hidden="true"></span>
<span class="help-inline" th:errors="*{__${name}__}">Error</span> <span class="help-inline" th:errors="*{__${name}__}">Error</span>
</th:block> </th:block>
</div> </div>
</div> </div>
</th:block> </th:block>
</form> </form>
</body> </body>
</html> </html>

View file

@ -1,108 +1,108 @@
<!doctype html> <!doctype html>
<html th:fragment="layout (template, menu)"> <html th:fragment="layout (template, menu)">
<head> <head>
<!-- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <!-- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1"> --> <meta name="viewport" content="width=device-width, initial-scale=1"> -->
<link rel="shortcut icon" type="image/x-icon" th:href="@{/resources/images/favicon.png}"> <link rel="shortcut icon" type="image/x-icon" th:href="@{/resources/images/favicon.png}">
<title>KidClinic :: a Spring Framework demonstration</title> <title>KidClinic :: a Spring Framework demonstration</title>
<!--[if lt IE 9]> <!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]--> <![endif]-->
<link rel="stylesheet" th:href="@{/resources/css/petclinic.css}"/> <link rel="stylesheet" th:href="@{/resources/css/petclinic.css}"/>
</head> </head>
<body> <body>
<h5> <h5>
<nav class="navbar navbar-inverse navbar-fixed-top navbar-right" role="navigation" th:fragment="header"> <nav class="navbar navbar-inverse navbar-fixed-top navbar-right" role="navigation" th:fragment="header">
<div class="navbar-header"> <div class="navbar-header">
<!-- <a class="navbar-brand" th:href="@{/}"><span></span></a> --> <!-- <a class="navbar-brand" th:href="@{/}"><span></span></a> -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#main-navbar"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#main-navbar">
<span class="icon-bar"></span> <span class="icon-bar"></span>
<span class="icon-bar"></span> <span class="icon-bar"></span>
<span class="icon-bar"></span> <span class="icon-bar"></span>
</button> </button>
</div> </div>
<div class="navbar-collapse collapse" id="main-navbar"> <div class="navbar-collapse collapse" id="main-navbar">
<ul class="nav navbar-nav nav-collapse navbar-right"> <ul class="nav navbar-nav nav-collapse navbar-right">
<a class="navbar-brand" href="#" size="5">KidClinic</a> <a class="navbar-brand" href="#" size="5">KidClinic</a>
<li th:class="${module == 'home' ? 'active' : ''}"><a href="#" th:href="@{/}" ><span class="glyphicon glyphicon-home"> Home</a></li> <li th:class="${module == 'home' ? 'active' : ''}"><a href="#" th:href="@{/}" ><span class="glyphicon glyphicon-home"> Home</a></li>
<li th:classappend="${module == 'parents' ? 'active' : ''}"><a href="/parents/find" th:href="@{/parents/find}" ><span class="glyphicon glyphicon-search"> Parents</a></li> <li th:classappend="${module == 'parents' ? 'active' : ''}"><a href="/parents/find" th:href="@{/parents/find}" ><span class="glyphicon glyphicon-search"> Parents</a></li>
<li th:classappend="${module == 'doctors' ? 'active' : ''}"><a href="/doctors.html" th:href="@{/doctors.html}"><span class="glyphicon glyphicon-th-list"> Doctors</a></li> <li th:classappend="${module == 'doctors' ? 'active' : ''}"><a href="/doctors.html" th:href="@{/doctors.html}"><span class="glyphicon glyphicon-th-list"> Doctors</a></li>
<li th:classappend="${module == 'reviews' ? 'active' : ''}"><a href="/reviews.html" th:href="@{/reviews.html}"><span class="glyphicon glyphicon-star"> Reviews</a></li> <li th:classappend="${module == 'reviews' ? 'active' : ''}"><a href="/reviews.html" th:href="@{/reviews.html}"><span class="glyphicon glyphicon-star"> Reviews</a></li>
<li th:classappend="${module == 'error' ? 'active' : ''}"><a href="/oops" th:href="@{/oops}" ><span class="glyphicon glyphicon-warning-sign"> Errors</a></li> <li th:classappend="${module == 'error' ? 'active' : ''}"><a href="/oops" th:href="@{/oops}" ><span class="glyphicon glyphicon-warning-sign"> Errors</a></li>
<!-- <li th:fragment="menuItem (path,active,title,glyph,text)" th:class="${active==menu ? 'active' : ''}"> <!-- <li th:fragment="menuItem (path,active,title,glyph,text)" th:class="${active==menu ? 'active' : ''}">
<a th:href="@{__${path}__}" th:title="${title}"> <a th:href="@{__${path}__}" th:title="${title}">
<span th:class="'glyphicon glyphicon-'+${glyph}" class="glyphicon glyphicon-home" aria-hidden="false"></span> <span th:class="'glyphicon glyphicon-'+${glyph}" class="glyphicon glyphicon-home" aria-hidden="false"></span>
<span th:text="${text}">Template</span> <span th:text="${text}">Template</span>
</a> </a>
</li> </li>
<li th:replace="::menuItem ('/','home','home page','home','Home')"> <li th:replace="::menuItem ('/','home','home page','home','Home')">
<span class="glyphicon glyphicon-home" aria-hidden="true"></span> <span class="glyphicon glyphicon-home" aria-hidden="true"></span>
<span>Home</span> <span>Home</span>
</li> </li>
<li th:replace="::menuItem ('/owners/find','owners','Find Parents','search','Find Parents')"> <li th:replace="::menuItem ('/owners/find','owners','Find Parents','search','Find Parents')">
<span class="glyphicon glyphicon-search" aria-hidden="true"></span> <span class="glyphicon glyphicon-search" aria-hidden="true"></span>
<span>Find Parents</span> <span>Find Parents</span>
</li> </li>
<li th:replace="::menuItem ('/vets.html','vets', 'Pediatricians','th-list','Pediatricians')"> <li th:replace="::menuItem ('/vets.html','vets', 'Pediatricians','th-list','Pediatricians')">
<span class="glyphicon glyphicon-th-list" aria-hidden="true"></span> <span class="glyphicon glyphicon-th-list" aria-hidden="true"></span>
<span>Pediatricians</span> <span>Pediatricians</span>
</li> </li>
<li th:replace="::menuItem ('/oups','error','trigger a RuntimeException to see how it is handled','warning-sign','Reviews')"> <li th:replace="::menuItem ('/oups','error','trigger a RuntimeException to see how it is handled','warning-sign','Reviews')">
<span class=" glyphicon glyphicon-star-empty" aria-hidden="true"></span> <span class=" glyphicon glyphicon-star-empty" aria-hidden="true"></span>
<span>Reviews</span> <span>Reviews</span>
</li> --> </li> -->
</ul> </ul>
</div> </div>
</nav> </nav>
</h5> </h5>
<div class="container-fluid"> <div class="container-fluid">
<div th:replace="${template}"/> <div th:replace="${template}"/>
<br/> <br/>
<br/> <br/>
<script th:src="@{/webjars/jquery/jquery.min.js}"></script> <script th:src="@{/webjars/jquery/jquery.min.js}"></script>
<script th:src="@{/webjars/jquery-ui/jquery-ui.min.js}"></script> <script th:src="@{/webjars/jquery-ui/jquery-ui.min.js}"></script>
<script th:src="@{/webjars/bootstrap/js/bootstrap.min.js}"></script> <script th:src="@{/webjars/bootstrap/js/bootstrap.min.js}"></script>
</body> </body>
</html> </html>

View file

@ -1,29 +1,29 @@
<html> <html>
<body> <body>
<form> <form>
<th:block th:fragment="select (label, name, items)"> <th:block th:fragment="select (label, name, items)">
<div th:with="valid=${!#fields.hasErrors(name)}" <div th:with="valid=${!#fields.hasErrors(name)}"
th:class="${'form-group' + (valid ? '' : ' has-error')}" th:class="${'form-group' + (valid ? '' : ' has-error')}"
class="form-group"> class="form-group">
<label class="col-sm-2 control-label" th:text="${label}">Label</label> <label class="col-sm-2 control-label" th:text="${label}">Label</label>
<div class="col-sm-10"> <div class="col-sm-10">
<select th:field="*{__${name}__}"> <select th:field="*{__${name}__}">
<option th:each="item : ${items}" th:value="${item}" <option th:each="item : ${items}" th:value="${item}"
th:text="${item}">dog</option> th:text="${item}">dog</option>
</select> </select>
<span th:if="${valid}" <span th:if="${valid}"
class="glyphicon glyphicon-ok form-control-feedback" class="glyphicon glyphicon-ok form-control-feedback"
aria-hidden="true"></span> aria-hidden="true"></span>
<th:block th:if="${!valid}"> <th:block th:if="${!valid}">
<span <span
class="glyphicon glyphicon-remove form-control-feedback" class="glyphicon glyphicon-remove form-control-feedback"
aria-hidden="true"></span> aria-hidden="true"></span>
<span class="help-inline" th:errors="*{__${name}__}">Error</span> <span class="help-inline" th:errors="*{__${name}__}">Error</span>
</th:block> </th:block>
</div> </div>
</div> </div>
</th:block> </th:block>
</form> </form>
</body> </body>
</html> </html>

View file

@ -1,38 +1,38 @@
<html xmlns:th="http://www.thymeleaf.org" <html xmlns:th="http://www.thymeleaf.org"
th:replace="~{fragments/layout :: layout (~{::body},'parents')}"> th:replace="~{fragments/layout :: layout (~{::body},'parents')}">
<body> <body>
<h2> <h2>
<th:block th:if="${kid['new']}">New </th:block> <th:block th:if="${kid['new']}">New </th:block>
Kid Kid
</h2> </h2>
<form th:object="${kid}" class="form-horizontal" method="post"> <form th:object="${kid}" class="form-horizontal" method="post">
<input type="hidden" name="id" th:value="*{id}" /> <input type="hidden" name="id" th:value="*{id}" />
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<div class="form-group"> <div class="form-group">
<label class="col-sm-2 control-label">Parent</label> <label class="col-sm-2 control-label">Parent</label>
<div class="col-sm-10"> <div class="col-sm-10">
<span th:text="${kid.parent?.firstName + ' ' + kid.parent?.lastName}" /> <span th:text="${kid.parent?.firstName + ' ' + kid.parent?.lastName}" />
</div> </div>
</div> </div>
<input <input
th:replace="~{fragments/inputField :: input ('Name', 'name')}" /> th:replace="~{fragments/inputField :: input ('Name', 'name')}" />
<input <input
th:replace="~{fragments/inputField :: input ('Birth Date', 'birthDate')}" /> th:replace="~{fragments/inputField :: input ('Birth Date', 'birthDate')}" />
<input <input
th:replace="~{fragments/selectField :: select ('Gender', 'gender', ${gender})}" /> th:replace="~{fragments/selectField :: select ('Gender', 'gender', ${gender})}" />
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="col-sm-offset-2 col-sm-10"> <div class="col-sm-offset-2 col-sm-10">
<button <button
th:with="text=${parent['new']} ? 'Add Kid' : 'Update Kid'" th:with="text=${parent['new']} ? 'Add Kid' : 'Update Kid'"
class="btn btn-default" type="submit" th:text="${text}">Add class="btn btn-default" type="submit" th:text="${text}">Add
Kid</button> Kid</button>
</div> </div>
</div> </div>
</form> </form>
</body> </body>
</html> </html>

View file

@ -1,61 +1,61 @@
<html xmlns:th="http://www.thymeleaf.org" <html xmlns:th="http://www.thymeleaf.org"
th:replace="~{fragments/layout :: layout (~{::body},'parents')}"> th:replace="~{fragments/layout :: layout (~{::body},'parents')}">
<body> <body>
<h2> <h2>
<th:block th:if="${visit['new']}">New </th:block> <th:block th:if="${visit['new']}">New </th:block>
Visit Visit
</h2> </h2>
<b>Kid</b> <b>Kid</b>
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr> <tr>
<th>Name</th> <th>Name</th>
<th>Birth Date</th> <th>Birth Date</th>
<th>Type</th> <th>Type</th>
<th>Parent</th> <th>Parent</th>
</tr> </tr>
</thead> </thead>
<tr> <tr>
<td th:text="${kid.name}" /></td> <td th:text="${kid.name}" /></td>
<td <td
th:text="${#calendars.format(kid.birthDate, 'yyyy-MM-dd')}" /></td> th:text="${#calendars.format(kid.birthDate, 'yyyy-MM-dd')}" /></td>
<td th:text="${kid.gender}" /></td> <td th:text="${kid.gender}" /></td>
<td <td
th:text="${kid.parent?.firstName + ' ' + kid.parent?.lastName}" /></td> th:text="${kid.parent?.firstName + ' ' + kid.parent?.lastName}" /></td>
</tr> </tr>
</table> </table>
<form th:object="${visit}" class="form-horizontal" method="post"> <form th:object="${visit}" class="form-horizontal" method="post">
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<input <input
th:replace="~{fragments/inputField :: input ('Date', 'date')}" /> th:replace="~{fragments/inputField :: input ('Date', 'date')}" />
<input <input
th:replace="~{fragments/inputField :: input ('Description', 'description')}" /> th:replace="~{fragments/inputField :: input ('Description', 'description')}" />
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="col-sm-offset-2 col-sm-10"> <div class="col-sm-offset-2 col-sm-10">
<input type="hidden" name="kidId" th:value="${kid.id}" /> <input type="hidden" name="kidId" th:value="${kid.id}" />
<button class="btn btn-default" type="submit">Add Visit</button> <button class="btn btn-default" type="submit">Add Visit</button>
</div> </div>
</div> </div>
</form> </form>
<br /> <br />
<b>Previous Visits</b> <b>Previous Visits</b>
<table class="table table-striped"> <table class="table table-striped">
<tr> <tr>
<th>Date</th> <th>Date</th>
<th>Description</th> <th>Description</th>
</tr> </tr>
<tr th:if="${!visit['new']}" th:each="visit : ${kid.visits}"> <tr th:if="${!visit['new']}" th:each="visit : ${kid.visits}">
<td th:text="${#calendars.format(visit.date, 'yyyy-MM-dd')}" /></td> <td th:text="${#calendars.format(visit.date, 'yyyy-MM-dd')}" /></td>
<td th:text=" ${visit.description}" /></td> <td th:text=" ${visit.description}" /></td>
</tr> </tr>
</table> </table>
</body> </body>
</html> </html>

View file

@ -1,30 +1,30 @@
<html xmlns:th="http://www.thymeleaf.org" <html xmlns:th="http://www.thymeleaf.org"
th:replace="~{fragments/layout :: layout (~{::body},'parents')}"> th:replace="~{fragments/layout :: layout (~{::body},'parents')}">
<body> <body>
<h2>Parent</h2> <h2>Parent</h2>
<form th:object="${parent}" class="form-horizontal" id="add-parent-form" method="post"> <form th:object="${parent}" class="form-horizontal" id="add-parent-form" method="post">
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<input <input
th:replace="~{fragments/inputField :: input ('First Name', 'firstName')}" /> th:replace="~{fragments/inputField :: input ('First Name', 'firstName')}" />
<input <input
th:replace="~{fragments/inputField :: input ('Last Name', 'lastName')}" /> th:replace="~{fragments/inputField :: input ('Last Name', 'lastName')}" />
<input <input
th:replace="~{fragments/inputField :: input ('Address', 'address')}" /> th:replace="~{fragments/inputField :: input ('Address', 'address')}" />
<input <input
th:replace="~{fragments/inputField :: input ('City', 'city')}" /> th:replace="~{fragments/inputField :: input ('City', 'city')}" />
<input <input
th:replace="~{fragments/inputField :: input ('Telephone', 'telephone')}" /> th:replace="~{fragments/inputField :: input ('Telephone', 'telephone')}" />
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="col-sm-offset-2 col-sm-10"> <div class="col-sm-offset-2 col-sm-10">
<button <button
th:with="text=${parent['new']} ? 'Add Parent' : 'Update Parent'" th:with="text=${parent['new']} ? 'Add Parent' : 'Update Parent'"
class="btn btn-default" type="submit" th:text="${text}">Add class="btn btn-default" type="submit" th:text="${text}">Add
Parent</button> Parent</button>
</div> </div>
</div> </div>
</form> </form>
</body> </body>
</html> </html>

View file

@ -1,35 +1,35 @@
<html xmlns:th="http://www.thymeleaf.org" <html xmlns:th="http://www.thymeleaf.org"
th:replace="~{fragments/layout :: layout (~{::body},'parents')}"> th:replace="~{fragments/layout :: layout (~{::body},'parents')}">
<body> <body>
<h2>Find Parents</h2> <h2>Find Parents</h2>
<form th:object="${parent}" th:action="@{/parents}" method="get" <form th:object="${parent}" th:action="@{/parents}" method="get"
class="form-horizontal" id="search-parent-form"> class="form-horizontal" id="search-parent-form">
<div class="form-group"> <div class="form-group">
<div class="control-group" id="lastName"> <div class="control-group" id="lastName">
<label class="col-sm-2 control-label">Last name </label> <label class="col-sm-2 control-label">Last name </label>
<div class="col-sm-10"> <div class="col-sm-10">
<input class="form-control" th:field="*{lastName}" size="30" <input class="form-control" th:field="*{lastName}" size="30"
maxlength="80" /> <span class="help-inline"><div maxlength="80" /> <span class="help-inline"><div
th:if="${#fields.hasAnyErrors()}"> th:if="${#fields.hasAnyErrors()}">
<p th:each="err : ${#fields.allErrors()}" th:text="${err}">Error</p> <p th:each="err : ${#fields.allErrors()}" th:text="${err}">Error</p>
</div></span> </div></span>
</div> </div>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="col-sm-offset-2 col-sm-10"> <div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default">Find <button type="submit" class="btn btn-default">Find
Parent</button> Parent</button>
</div> </div>
</div> </div>
</form> </form>
<br /> <br />
<a class="btn btn-default" th:href="@{/parents/new}">Add Parent</a> <a class="btn btn-default" th:href="@{/parents/new}">Add Parent</a>
</body> </body>
</html> </html>

View file

@ -1,83 +1,83 @@
<!DOCTYPE html> <!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" <html xmlns:th="http://www.thymeleaf.org"
th:replace="~{fragments/layout :: layout (~{::body},'parents')}"> th:replace="~{fragments/layout :: layout (~{::body},'parents')}">
<body> <body>
<h2>Parent Information</h2> <h2>Parent Information</h2>
<table class="table table-striped" th:object="${parent}"> <table class="table table-striped" th:object="${parent}">
<tr> <tr>
<th>Name</th> <th>Name</th>
<td><b th:text="*{firstName + ' ' + lastName}"></b></td> <td><b th:text="*{firstName + ' ' + lastName}"></b></td>
</tr> </tr>
<tr> <tr>
<th>Address</th> <th>Address</th>
<td th:text="*{address}" /></td> <td th:text="*{address}" /></td>
</tr> </tr>
<tr> <tr>
<th>City</th> <th>City</th>
<td th:text="*{city}" /></td> <td th:text="*{city}" /></td>
</tr> </tr>
<tr> <tr>
<th>Telephone</th> <th>Telephone</th>
<td th:text="*{telephone}" /></td> <td th:text="*{telephone}" /></td>
</tr> </tr>
</table> </table>
<a th:href="@{{id}/edit(id=${parent.id})}" class="btn btn-default">Edit <a th:href="@{{id}/edit(id=${parent.id})}" class="btn btn-default">Edit
Parent</a> Parent</a>
<a th:href="@{{id}/kids/new(id=${parent.id})}" class="btn btn-default">Add <a th:href="@{{id}/kids/new(id=${parent.id})}" class="btn btn-default">Add
New Child</a> New Child</a>
<br /> <br />
<br /> <br />
<br /> <br />
<h2>Children and Visits</h2> <h2>Children and Visits</h2>
<table class="table table-striped"> <table class="table table-striped">
<tr th:each="kid : ${parent.kids}"> <tr th:each="kid : ${parent.kids}">
<td valign="top"> <td valign="top">
<dl class="dl-horizontal"> <dl class="dl-horizontal">
<dt>Name</dt> <dt>Name</dt>
<dd th:text="${kid.name}" /></dd> <dd th:text="${kid.name}" /></dd>
<dt>Birth Date</dt> <dt>Birth Date</dt>
<dd <dd
th:text="${#calendars.format(kid.birthDate, 'yyyy-MM-dd')}" /></dd> th:text="${#calendars.format(kid.birthDate, 'yyyy-MM-dd')}" /></dd>
<dt>Gender</dt> <dt>Gender</dt>
<dd th:text="${kid.gender}" /></dd> <dd th:text="${kid.gender}" /></dd>
</dl> </dl>
</td> </td>
<td valign="top"> <td valign="top">
<table class="table-condensed"> <table class="table-condensed">
<thead> <thead>
<tr> <tr>
<th>Visit Date</th> <th>Visit Date</th>
<th>Description</th> <th>Description</th>
</tr> </tr>
</thead> </thead>
<tr th:each="visit : ${kid.visits}"> <tr th:each="visit : ${kid.visits}">
<td th:text="${#calendars.format(visit.date, 'yyyy-MM-dd')}"></td> <td th:text="${#calendars.format(visit.date, 'yyyy-MM-dd')}"></td>
<td th:text="${visit?.description}"></td> <td th:text="${visit?.description}"></td>
</tr> </tr>
<tr> <tr>
<td><a <td><a
th:href="@{{parentId}/kids/{kidId}/edit(parentId=${parent.id},kidId=${kid.id})}">Edit th:href="@{{parentId}/kids/{kidId}/edit(parentId=${parent.id},kidId=${kid.id})}">Edit
Child</a></td> Child</a></td>
<td><a <td><a
th:href="@{{parentId}/kids/{kidId}/visits/new(parentId=${parent.id},kidId=${kid.id})}">Add th:href="@{{parentId}/kids/{kidId}/visits/new(parentId=${parent.id},kidId=${kid.id})}">Add
Visit</a></td> Visit</a></td>
</tr> </tr>
</table> </table>
</td> </td>
</tr> </tr>
</table> </table>
</body> </body>
</html> </html>

View file

@ -1,33 +1,33 @@
<!DOCTYPE html> <!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" th:replace="~{fragments/layout :: layout (~{::body},'parents')}"> <html xmlns:th="http://www.thymeleaf.org" th:replace="~{fragments/layout :: layout (~{::body},'parents')}">
<body> <body>
<h2>Parents</h2> <h2>Parents</h2>
<table id="doctors" class="table table-striped"> <table id="doctors" class="table table-striped">
<thead> <thead>
<tr> <tr>
<th style="width: 150px;">Name</th> <th style="width: 150px;">Name</th>
<th style="width: 200px;">Address</th> <th style="width: 200px;">Address</th>
<th>City</th> <th>City</th>
<th style="width: 120px">Telephone</th> <th style="width: 120px">Telephone</th>
<th>Children</th> <th>Children</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr th:each="parent : ${selections}"> <tr th:each="parent : ${selections}">
<td> <td>
<a th:href="@{parents/__${parent.id}__}" th:text="${parent.firstName + ' ' + parent.lastName}"/></a> <a th:href="@{parents/__${parent.id}__}" th:text="${parent.firstName + ' ' + parent.lastName}"/></a>
</td> </td>
<td th:text="${parent.address}"/> <td th:text="${parent.address}"/>
<td th:text="${parent.city}"/> <td th:text="${parent.city}"/>
<td th:text="${parent.telephone}"/> <td th:text="${parent.telephone}"/>
<td><span th:each="kid : ${parent.kids}" th:text="${kid.name} + ' '"/></td> <td><span th:each="kid : ${parent.kids}" th:text="${kid.name} + ' '"/></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</body> </body>
</html> </html>

View file

@ -1,10 +1,10 @@
<!DOCTYPE html> <!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" th:replace="~{fragments/layout :: layout (~{::body},'reviews')}"> <html xmlns:th="http://www.thymeleaf.org" th:replace="~{fragments/layout :: layout (~{::body},'reviews')}">
<body> <body>
<h2>Reviews</h2> <h2>Reviews</h2>
<p>We are currently curating our review.</p> <p>We are currently curating our review.</p>
</body> </body>
</html> </html>

View file

@ -1,142 +1,142 @@
<!DOCTYPE html> <!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" th:replace="~{fragments/layout :: layout (~{::body},'home')}"> <html xmlns:th="http://www.thymeleaf.org" th:replace="~{fragments/layout :: layout (~{::body},'home')}">
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<body> <body>
<div id ="navbar-2" class="container-custom"> <div id ="navbar-2" class="container-custom">
<ul class="nav navbar-nav nav-collapse navbar-right"> <ul class="nav navbar-nav nav-collapse navbar-right">
<li > <a href="#myCarousel" class="active">Photos</a> </li> <li > <a href="#myCarousel" class="active">Photos</a> </li>
<li > <a href="#portion2">About</a> </li> <li > <a href="#portion2">About</a> </li>
<li > <a href="#portion3">Features</a></li> <li > <a href="#portion3">Features</a></li>
<li > <a href="#portion4">Future</a></li> <li > <a href="#portion4">Future</a></li>
</ul> </ul>
</div> </div>
<!-- This is a test for a picture car. --> <!-- This is a test for a picture car. -->
<div id="myCarousel" class="carousel slide" data-ride="carousel"> <div id="myCarousel" class="carousel slide" data-ride="carousel">
<!-- Indicators --> <!-- Indicators -->
<ol class="carousel-indicators"> <ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li> <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li> <li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li> <li data-target="#myCarousel" data-slide-to="2"></li>
</ol> </ol>
<!-- Wrapper for slides --> <!-- Wrapper for slides -->
<div class="carousel-inner"> <div class="carousel-inner">
<div class="item active"> <div class="item active">
<img src="../static/resources/images/doctor4.jpg" th:src="@{/resources/images/doctor4.jpg}" alt="Doctor" style="width:100%;"> <img src="../static/resources/images/doctor4.jpg" th:src="@{/resources/images/doctor4.jpg}" alt="Doctor" style="width:100%;">
</div> </div>
<div class="item"> <div class="item">
<img src="../static/resources/images/doctor5.jpg" th:src="@{/resources/images/doctor5.jpg}" alt="Doctor" style="width:100%;"> <img src="../static/resources/images/doctor5.jpg" th:src="@{/resources/images/doctor5.jpg}" alt="Doctor" style="width:100%;">
</div> </div>
<div class="item"> <div class="item">
<img src="../static/resources/images/doctor3.jpg" th:src="@{/resources/images/doctor3.jpg}" alt="Doctor" style="width:100%;"> <img src="../static/resources/images/doctor3.jpg" th:src="@{/resources/images/doctor3.jpg}" alt="Doctor" style="width:100%;">
</div> </div>
</div> </div>
<!-- Left and right controls --> <!-- Left and right controls -->
<a class="left carousel-control" href="#myCarousel" data-slide="prev"> <a class="left carousel-control" href="#myCarousel" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span> <span class="glyphicon glyphicon-chevron-left"></span>
<span class="sr-only">Previous</span> <span class="sr-only">Previous</span>
</a> </a>
<a class="right carousel-control" href="#myCarousel" data-slide="next"> <a class="right carousel-control" href="#myCarousel" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span> <span class="glyphicon glyphicon-chevron-right"></span>
<span class="sr-only">Next</span> <span class="sr-only">Next</span>
</a> </a>
</div> </div>
<div id= "portion2" class="portion two"> <div id= "portion2" class="portion two">
<h2>Our Story</h2> <h2>Our Story</h2>
</div> </div>
<div class="info"> <div class="info">
<h3>Creation</h3> <h3>Creation</h3>
<p>KidClinic is a platform to simplify healthcare, not for insurance companies but for you: the cutomers and the doctors. We want to streamline how records are managed and simplify the process of managing pediatric health. KidClinic expediates the oft tedious process of permissions for managing a minor's health, organizing the records in an intuitive but archivable mainframe.</p> <p>KidClinic is a platform to simplify healthcare, not for insurance companies but for you: the cutomers and the doctors. We want to streamline how records are managed and simplify the process of managing pediatric health. KidClinic expediates the oft tedious process of permissions for managing a minor's health, organizing the records in an intuitive but archivable mainframe.</p>
<div class="button"> <div class="button">
<a href="#">Example Button</a> <a href="#">Example Button</a>
</div> </div>
</div> </div>
<div class="portion five" id ="portion3"> <div class="portion five" id ="portion3">
<h2>Features</h2> <h2>Features</h2>
</div> </div>
<div class="info"> <div class="info">
<h3>Parents</h3> <h3>Parents</h3>
<p>The database we utilize allows doctors to safely, securely, search for parents in the system of their practice. Upon search, users are able to see the children, the actual patients, associated with the parent or guardian. This stores all family information in one area, easily compiling family history and a broader view of clinical practice. It is our hope this expediates care for both patients and doctors. <p>The database we utilize allows doctors to safely, securely, search for parents in the system of their practice. Upon search, users are able to see the children, the actual patients, associated with the parent or guardian. This stores all family information in one area, easily compiling family history and a broader view of clinical practice. It is our hope this expediates care for both patients and doctors.
</p> </p>
<h3>Doctors</h3> <h3>Doctors</h3>
<p>KidClinic is a service for parents as well. All registered doctors, verified for quality and certification by us, appear on the doctor listing. Users can search by profession, speciality and history. With tools to filter and search, finding the right doctor for you and your kids has never been easier. <p>KidClinic is a service for parents as well. All registered doctors, verified for quality and certification by us, appear on the doctor listing. Users can search by profession, speciality and history. With tools to filter and search, finding the right doctor for you and your kids has never been easier.
</p> </p>
<h3>Reviews</h3> <h3>Reviews</h3>
<p>Here at KidClinic, we want to ensure quality care and incorporate facets from disparate sources. This includes an interactive review function, where you can directly review doctors and influence their appearance on the search feature. Your insight makes a difference for future care, directly, immediately.You can also see other's reviews and comments to facilitate your decisions on care. <p>Here at KidClinic, we want to ensure quality care and incorporate facets from disparate sources. This includes an interactive review function, where you can directly review doctors and influence their appearance on the search feature. Your insight makes a difference for future care, directly, immediately.You can also see other's reviews and comments to facilitate your decisions on care.
</p> </p>
<div class="button"> <div class="button">
<a href="#">Example Button</a> <a href="#">Example Button</a>
</div> </div>
</div> </div>
<div class="portion four" id="portion4"> <div class="portion four" id="portion4">
<h2>The Future</h2> <h2>The Future</h2>
</div> </div>
<div class="info"> <div class="info">
<h3>Our Vision</h3> <h3>Our Vision</h3>
<p>In the ever expanding and fickle internet era it is not enough to have a product. So we have crafted a vision forward, together, to revolutionize healthcare at your finger tips. This means integrating calendars, live notifications of appointment availability, and even mapping your needs. Integration can be scary and rightfully so. But we provide data for you and your family because frankly the current state of healthcare is unacceptable. This is a step in a multitude of miles to perfecting it. <p>In the ever expanding and fickle internet era it is not enough to have a product. So we have crafted a vision forward, together, to revolutionize healthcare at your finger tips. This means integrating calendars, live notifications of appointment availability, and even mapping your needs. Integration can be scary and rightfully so. But we provide data for you and your family because frankly the current state of healthcare is unacceptable. This is a step in a multitude of miles to perfecting it.
</p> </p>
<div class="button"> <div class="button">
<a href="#">To Top</a> <a href="#">To Top</a>
</div> </div>
</div> </div>
</body> </body>
</html> </html>

View file

@ -1,4 +1,4 @@
#List of preProcessors #List of preProcessors
preProcessors=lessCssImport preProcessors=lessCssImport
#List of postProcessors #List of postProcessors
postProcessors=less4j postProcessors=less4j

View file

@ -1,6 +1,6 @@
<groups xmlns="http://www.isdc.ro/wro"> <groups xmlns="http://www.isdc.ro/wro">
<group name="petclinic"> <group name="petclinic">
<css>classpath:META-INF/resources/webjars/bootstrap/3.3.6/less/bootstrap.less</css> <css>classpath:META-INF/resources/webjars/bootstrap/3.3.6/less/bootstrap.less</css>
<css>/petclinic.less</css> <css>/petclinic.less</css>
</group> </group>
</groups> </groups>

View file

@ -1,45 +1,45 @@
package org.springframework.samples.petclinic.model; package org.springframework.samples.petclinic.model;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import java.util.Locale; import java.util.Locale;
import java.util.Set; import java.util.Set;
import javax.validation.ConstraintViolation; import javax.validation.ConstraintViolation;
import javax.validation.Validator; import javax.validation.Validator;
import org.junit.Test; import org.junit.Test;
import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
/** /**
* @author Michael Isvy * @author Michael Isvy
* Simple test to make sure that Bean Validation is working * Simple test to make sure that Bean Validation is working
* (useful when upgrading to a new version of Hibernate Validator/ Bean Validation) * (useful when upgrading to a new version of Hibernate Validator/ Bean Validation)
*/ */
public class ValidatorTests { public class ValidatorTests {
private Validator createValidator() { private Validator createValidator() {
LocalValidatorFactoryBean localValidatorFactoryBean = new LocalValidatorFactoryBean(); LocalValidatorFactoryBean localValidatorFactoryBean = new LocalValidatorFactoryBean();
localValidatorFactoryBean.afterPropertiesSet(); localValidatorFactoryBean.afterPropertiesSet();
return localValidatorFactoryBean; return localValidatorFactoryBean;
} }
@Test @Test
public void shouldNotValidateWhenFirstNameEmpty() { public void shouldNotValidateWhenFirstNameEmpty() {
LocaleContextHolder.setLocale(Locale.ENGLISH); LocaleContextHolder.setLocale(Locale.ENGLISH);
Person person = new Person(); Person person = new Person();
person.setFirstName(""); person.setFirstName("");
person.setLastName("smith"); person.setLastName("smith");
Validator validator = createValidator(); Validator validator = createValidator();
Set<ConstraintViolation<Person>> constraintViolations = validator.validate(person); Set<ConstraintViolation<Person>> constraintViolations = validator.validate(person);
assertThat(constraintViolations.size()).isEqualTo(1); assertThat(constraintViolations.size()).isEqualTo(1);
ConstraintViolation<Person> violation = constraintViolations.iterator().next(); ConstraintViolation<Person> violation = constraintViolations.iterator().next();
assertThat(violation.getPropertyPath().toString()).isEqualTo("firstName"); assertThat(violation.getPropertyPath().toString()).isEqualTo("firstName");
assertThat(violation.getMessage()).isEqualTo("may not be empty"); assertThat(violation.getMessage()).isEqualTo("may not be empty");
} }
} }

View file

@ -1,179 +1,179 @@
package org.springframework.samples.petclinic.owner; package org.springframework.samples.petclinic.owner;
import static org.hamcrest.Matchers.hasProperty; import static org.hamcrest.Matchers.hasProperty;
import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.is;
import static org.mockito.BDDMockito.given; import static org.mockito.BDDMockito.given;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.model; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.model;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.view; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.view;
import org.assertj.core.util.Lists; import org.assertj.core.util.Lists;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.samples.petclinic.owner.Owner; import org.springframework.samples.petclinic.owner.Owner;
import org.springframework.samples.petclinic.owner.OwnerController; import org.springframework.samples.petclinic.owner.OwnerController;
import org.springframework.samples.petclinic.owner.OwnerRepository; import org.springframework.samples.petclinic.owner.OwnerRepository;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MockMvc;
/** /**
* Test class for {@link OwnerController} * Test class for {@link OwnerController}
* *
* @author Colin But * @author Colin But
*/ */
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@WebMvcTest(OwnerController.class) @WebMvcTest(OwnerController.class)
public class OwnerControllerTests { public class OwnerControllerTests {
private static final int TEST_OWNER_ID = 1; private static final int TEST_OWNER_ID = 1;
@Autowired @Autowired
private MockMvc mockMvc; private MockMvc mockMvc;
@MockBean @MockBean
private OwnerRepository owners; private OwnerRepository owners;
private Owner george; private Owner george;
@Before @Before
public void setup() { public void setup() {
george = new Owner(); george = new Owner();
george.setId(TEST_OWNER_ID); george.setId(TEST_OWNER_ID);
george.setFirstName("George"); george.setFirstName("George");
george.setLastName("Franklin"); george.setLastName("Franklin");
george.setAddress("110 W. Liberty St."); george.setAddress("110 W. Liberty St.");
george.setCity("Madison"); george.setCity("Madison");
george.setTelephone("6085551023"); george.setTelephone("6085551023");
given(this.owners.findById(TEST_OWNER_ID)).willReturn(george); given(this.owners.findById(TEST_OWNER_ID)).willReturn(george);
} }
@Test @Test
public void testInitCreationForm() throws Exception { public void testInitCreationForm() throws Exception {
mockMvc.perform(get("/owners/new")) mockMvc.perform(get("/owners/new"))
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(model().attributeExists("owner")) .andExpect(model().attributeExists("owner"))
.andExpect(view().name("owners/createOrUpdateOwnerForm")); .andExpect(view().name("owners/createOrUpdateOwnerForm"));
} }
@Test @Test
public void testProcessCreationFormSuccess() throws Exception { public void testProcessCreationFormSuccess() throws Exception {
mockMvc.perform(post("/owners/new") mockMvc.perform(post("/owners/new")
.param("firstName", "Joe") .param("firstName", "Joe")
.param("lastName", "Bloggs") .param("lastName", "Bloggs")
.param("address", "123 Caramel Street") .param("address", "123 Caramel Street")
.param("city", "London") .param("city", "London")
.param("telephone", "01316761638") .param("telephone", "01316761638")
) )
.andExpect(status().is3xxRedirection()); .andExpect(status().is3xxRedirection());
} }
@Test @Test
public void testProcessCreationFormHasErrors() throws Exception { public void testProcessCreationFormHasErrors() throws Exception {
mockMvc.perform(post("/owners/new") mockMvc.perform(post("/owners/new")
.param("firstName", "Joe") .param("firstName", "Joe")
.param("lastName", "Bloggs") .param("lastName", "Bloggs")
.param("city", "London") .param("city", "London")
) )
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(model().attributeHasErrors("owner")) .andExpect(model().attributeHasErrors("owner"))
.andExpect(model().attributeHasFieldErrors("owner", "address")) .andExpect(model().attributeHasFieldErrors("owner", "address"))
.andExpect(model().attributeHasFieldErrors("owner", "telephone")) .andExpect(model().attributeHasFieldErrors("owner", "telephone"))
.andExpect(view().name("owners/createOrUpdateOwnerForm")); .andExpect(view().name("owners/createOrUpdateOwnerForm"));
} }
@Test @Test
public void testInitFindForm() throws Exception { public void testInitFindForm() throws Exception {
mockMvc.perform(get("/owners/find")) mockMvc.perform(get("/owners/find"))
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(model().attributeExists("owner")) .andExpect(model().attributeExists("owner"))
.andExpect(view().name("owners/findOwners")); .andExpect(view().name("owners/findOwners"));
} }
@Test @Test
public void testProcessFindFormSuccess() throws Exception { public void testProcessFindFormSuccess() throws Exception {
given(this.owners.findByLastName("")).willReturn(Lists.newArrayList(george, new Owner())); given(this.owners.findByLastName("")).willReturn(Lists.newArrayList(george, new Owner()));
mockMvc.perform(get("/owners")) mockMvc.perform(get("/owners"))
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(view().name("owners/ownersList")); .andExpect(view().name("owners/ownersList"));
} }
@Test @Test
public void testProcessFindFormByLastName() throws Exception { public void testProcessFindFormByLastName() throws Exception {
given(this.owners.findByLastName(george.getLastName())).willReturn(Lists.newArrayList(george)); given(this.owners.findByLastName(george.getLastName())).willReturn(Lists.newArrayList(george));
mockMvc.perform(get("/owners") mockMvc.perform(get("/owners")
.param("lastName", "Franklin") .param("lastName", "Franklin")
) )
.andExpect(status().is3xxRedirection()) .andExpect(status().is3xxRedirection())
.andExpect(view().name("redirect:/owners/" + TEST_OWNER_ID)); .andExpect(view().name("redirect:/owners/" + TEST_OWNER_ID));
} }
@Test @Test
public void testProcessFindFormNoOwnersFound() throws Exception { public void testProcessFindFormNoOwnersFound() throws Exception {
mockMvc.perform(get("/owners") mockMvc.perform(get("/owners")
.param("lastName", "Unknown Surname") .param("lastName", "Unknown Surname")
) )
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(model().attributeHasFieldErrors("owner", "lastName")) .andExpect(model().attributeHasFieldErrors("owner", "lastName"))
.andExpect(model().attributeHasFieldErrorCode("owner", "lastName", "notFound")) .andExpect(model().attributeHasFieldErrorCode("owner", "lastName", "notFound"))
.andExpect(view().name("owners/findOwners")); .andExpect(view().name("owners/findOwners"));
} }
@Test @Test
public void testInitUpdateOwnerForm() throws Exception { public void testInitUpdateOwnerForm() throws Exception {
mockMvc.perform(get("/owners/{ownerId}/edit", TEST_OWNER_ID)) mockMvc.perform(get("/owners/{ownerId}/edit", TEST_OWNER_ID))
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(model().attributeExists("owner")) .andExpect(model().attributeExists("owner"))
.andExpect(model().attribute("owner", hasProperty("lastName", is("Franklin")))) .andExpect(model().attribute("owner", hasProperty("lastName", is("Franklin"))))
.andExpect(model().attribute("owner", hasProperty("firstName", is("George")))) .andExpect(model().attribute("owner", hasProperty("firstName", is("George"))))
.andExpect(model().attribute("owner", hasProperty("address", is("110 W. Liberty St.")))) .andExpect(model().attribute("owner", hasProperty("address", is("110 W. Liberty St."))))
.andExpect(model().attribute("owner", hasProperty("city", is("Madison")))) .andExpect(model().attribute("owner", hasProperty("city", is("Madison"))))
.andExpect(model().attribute("owner", hasProperty("telephone", is("6085551023")))) .andExpect(model().attribute("owner", hasProperty("telephone", is("6085551023"))))
.andExpect(view().name("owners/createOrUpdateOwnerForm")); .andExpect(view().name("owners/createOrUpdateOwnerForm"));
} }
@Test @Test
public void testProcessUpdateOwnerFormSuccess() throws Exception { public void testProcessUpdateOwnerFormSuccess() throws Exception {
mockMvc.perform(post("/owners/{ownerId}/edit", TEST_OWNER_ID) mockMvc.perform(post("/owners/{ownerId}/edit", TEST_OWNER_ID)
.param("firstName", "Joe") .param("firstName", "Joe")
.param("lastName", "Bloggs") .param("lastName", "Bloggs")
.param("address", "123 Caramel Street") .param("address", "123 Caramel Street")
.param("city", "London") .param("city", "London")
.param("telephone", "01616291589") .param("telephone", "01616291589")
) )
.andExpect(status().is3xxRedirection()) .andExpect(status().is3xxRedirection())
.andExpect(view().name("redirect:/owners/{ownerId}")); .andExpect(view().name("redirect:/owners/{ownerId}"));
} }
@Test @Test
public void testProcessUpdateOwnerFormHasErrors() throws Exception { public void testProcessUpdateOwnerFormHasErrors() throws Exception {
mockMvc.perform(post("/owners/{ownerId}/edit", TEST_OWNER_ID) mockMvc.perform(post("/owners/{ownerId}/edit", TEST_OWNER_ID)
.param("firstName", "Joe") .param("firstName", "Joe")
.param("lastName", "Bloggs") .param("lastName", "Bloggs")
.param("city", "London") .param("city", "London")
) )
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(model().attributeHasErrors("owner")) .andExpect(model().attributeHasErrors("owner"))
.andExpect(model().attributeHasFieldErrors("owner", "address")) .andExpect(model().attributeHasFieldErrors("owner", "address"))
.andExpect(model().attributeHasFieldErrors("owner", "telephone")) .andExpect(model().attributeHasFieldErrors("owner", "telephone"))
.andExpect(view().name("owners/createOrUpdateOwnerForm")); .andExpect(view().name("owners/createOrUpdateOwnerForm"));
} }
@Test @Test
public void testShowOwner() throws Exception { public void testShowOwner() throws Exception {
mockMvc.perform(get("/owners/{ownerId}", TEST_OWNER_ID)) mockMvc.perform(get("/owners/{ownerId}", TEST_OWNER_ID))
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(model().attribute("owner", hasProperty("lastName", is("Franklin")))) .andExpect(model().attribute("owner", hasProperty("lastName", is("Franklin"))))
.andExpect(model().attribute("owner", hasProperty("firstName", is("George")))) .andExpect(model().attribute("owner", hasProperty("firstName", is("George"))))
.andExpect(model().attribute("owner", hasProperty("address", is("110 W. Liberty St.")))) .andExpect(model().attribute("owner", hasProperty("address", is("110 W. Liberty St."))))
.andExpect(model().attribute("owner", hasProperty("city", is("Madison")))) .andExpect(model().attribute("owner", hasProperty("city", is("Madison"))))
.andExpect(model().attribute("owner", hasProperty("telephone", is("6085551023")))) .andExpect(model().attribute("owner", hasProperty("telephone", is("6085551023"))))
.andExpect(view().name("owners/ownerDetails")); .andExpect(view().name("owners/ownerDetails"));
} }
} }

View file

@ -1,127 +1,127 @@
package org.springframework.samples.petclinic.owner; package org.springframework.samples.petclinic.owner;
import static org.mockito.BDDMockito.given; import static org.mockito.BDDMockito.given;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.model; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.model;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.view; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.view;
import org.assertj.core.util.Lists; import org.assertj.core.util.Lists;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType; import org.springframework.context.annotation.FilterType;
import org.springframework.samples.petclinic.owner.Owner; import org.springframework.samples.petclinic.owner.Owner;
import org.springframework.samples.petclinic.owner.OwnerRepository; import org.springframework.samples.petclinic.owner.OwnerRepository;
import org.springframework.samples.petclinic.owner.Pet; import org.springframework.samples.petclinic.owner.Pet;
import org.springframework.samples.petclinic.owner.PetController; import org.springframework.samples.petclinic.owner.PetController;
import org.springframework.samples.petclinic.owner.PetRepository; import org.springframework.samples.petclinic.owner.PetRepository;
import org.springframework.samples.petclinic.owner.PetType; import org.springframework.samples.petclinic.owner.PetType;
import org.springframework.samples.petclinic.owner.PetTypeFormatter; import org.springframework.samples.petclinic.owner.PetTypeFormatter;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MockMvc;
/** /**
* Test class for the {@link PetController} * Test class for the {@link PetController}
* *
* @author Colin But * @author Colin But
*/ */
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@WebMvcTest(value = PetController.class, @WebMvcTest(value = PetController.class,
includeFilters = @ComponentScan.Filter( includeFilters = @ComponentScan.Filter(
value = PetTypeFormatter.class, value = PetTypeFormatter.class,
type = FilterType.ASSIGNABLE_TYPE)) type = FilterType.ASSIGNABLE_TYPE))
public class PetControllerTests { public class PetControllerTests {
private static final int TEST_OWNER_ID = 1; private static final int TEST_OWNER_ID = 1;
private static final int TEST_PET_ID = 1; private static final int TEST_PET_ID = 1;
@Autowired @Autowired
private MockMvc mockMvc; private MockMvc mockMvc;
@MockBean @MockBean
private PetRepository pets; private PetRepository pets;
@MockBean @MockBean
private OwnerRepository owners; private OwnerRepository owners;
@Before @Before
public void setup() { public void setup() {
PetType cat = new PetType(); PetType cat = new PetType();
cat.setId(3); cat.setId(3);
cat.setName("hamster"); cat.setName("hamster");
given(this.pets.findPetTypes()).willReturn(Lists.newArrayList(cat)); given(this.pets.findPetTypes()).willReturn(Lists.newArrayList(cat));
given(this.owners.findById(TEST_OWNER_ID)).willReturn(new Owner()); given(this.owners.findById(TEST_OWNER_ID)).willReturn(new Owner());
given(this.pets.findById(TEST_PET_ID)).willReturn(new Pet()); given(this.pets.findById(TEST_PET_ID)).willReturn(new Pet());
} }
@Test @Test
public void testInitCreationForm() throws Exception { public void testInitCreationForm() throws Exception {
mockMvc.perform(get("/owners/{ownerId}/pets/new", TEST_OWNER_ID)) mockMvc.perform(get("/owners/{ownerId}/pets/new", TEST_OWNER_ID))
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(view().name("pets/createOrUpdatePetForm")) .andExpect(view().name("pets/createOrUpdatePetForm"))
.andExpect(model().attributeExists("pet")); .andExpect(model().attributeExists("pet"));
} }
@Test @Test
public void testProcessCreationFormSuccess() throws Exception { public void testProcessCreationFormSuccess() throws Exception {
mockMvc.perform(post("/owners/{ownerId}/pets/new", TEST_OWNER_ID) mockMvc.perform(post("/owners/{ownerId}/pets/new", TEST_OWNER_ID)
.param("name", "Betty") .param("name", "Betty")
.param("type", "hamster") .param("type", "hamster")
.param("birthDate", "2015/02/12") .param("birthDate", "2015/02/12")
) )
.andExpect(status().is3xxRedirection()) .andExpect(status().is3xxRedirection())
.andExpect(view().name("redirect:/owners/{ownerId}")); .andExpect(view().name("redirect:/owners/{ownerId}"));
} }
@Test @Test
public void testProcessCreationFormHasErrors() throws Exception { public void testProcessCreationFormHasErrors() throws Exception {
mockMvc.perform(post("/owners/{ownerId}/pets/{petId}/edit", TEST_OWNER_ID, TEST_PET_ID) mockMvc.perform(post("/owners/{ownerId}/pets/{petId}/edit", TEST_OWNER_ID, TEST_PET_ID)
.param("name", "Betty") .param("name", "Betty")
.param("birthDate", "2015/02/12") .param("birthDate", "2015/02/12")
) )
.andExpect(model().attributeHasNoErrors("owner")) .andExpect(model().attributeHasNoErrors("owner"))
.andExpect(model().attributeHasErrors("pet")) .andExpect(model().attributeHasErrors("pet"))
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(view().name("pets/createOrUpdatePetForm")); .andExpect(view().name("pets/createOrUpdatePetForm"));
} }
@Test @Test
public void testInitUpdateForm() throws Exception { public void testInitUpdateForm() throws Exception {
mockMvc.perform(get("/owners/{ownerId}/pets/{petId}/edit", TEST_OWNER_ID, TEST_PET_ID)) mockMvc.perform(get("/owners/{ownerId}/pets/{petId}/edit", TEST_OWNER_ID, TEST_PET_ID))
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(model().attributeExists("pet")) .andExpect(model().attributeExists("pet"))
.andExpect(view().name("pets/createOrUpdatePetForm")); .andExpect(view().name("pets/createOrUpdatePetForm"));
} }
@Test @Test
public void testProcessUpdateFormSuccess() throws Exception { public void testProcessUpdateFormSuccess() throws Exception {
mockMvc.perform(post("/owners/{ownerId}/pets/{petId}/edit", TEST_OWNER_ID, TEST_PET_ID) mockMvc.perform(post("/owners/{ownerId}/pets/{petId}/edit", TEST_OWNER_ID, TEST_PET_ID)
.param("name", "Betty") .param("name", "Betty")
.param("type", "hamster") .param("type", "hamster")
.param("birthDate", "2015/02/12") .param("birthDate", "2015/02/12")
) )
.andExpect(status().is3xxRedirection()) .andExpect(status().is3xxRedirection())
.andExpect(view().name("redirect:/owners/{ownerId}")); .andExpect(view().name("redirect:/owners/{ownerId}"));
} }
@Test @Test
public void testProcessUpdateFormHasErrors() throws Exception { public void testProcessUpdateFormHasErrors() throws Exception {
mockMvc.perform(post("/owners/{ownerId}/pets/{petId}/edit", TEST_OWNER_ID, TEST_PET_ID) mockMvc.perform(post("/owners/{ownerId}/pets/{petId}/edit", TEST_OWNER_ID, TEST_PET_ID)
.param("name", "Betty") .param("name", "Betty")
.param("birthDate", "2015/02/12") .param("birthDate", "2015/02/12")
) )
.andExpect(model().attributeHasNoErrors("owner")) .andExpect(model().attributeHasNoErrors("owner"))
.andExpect(model().attributeHasErrors("pet")) .andExpect(model().attributeHasErrors("pet"))
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(view().name("pets/createOrUpdatePetForm")); .andExpect(view().name("pets/createOrUpdatePetForm"));
} }
} }

View file

@ -1,80 +1,80 @@
package org.springframework.samples.petclinic.owner; package org.springframework.samples.petclinic.owner;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import java.text.ParseException; import java.text.ParseException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.Mockito; import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner; import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.samples.petclinic.owner.PetRepository; import org.springframework.samples.petclinic.owner.PetRepository;
import org.springframework.samples.petclinic.owner.PetType; import org.springframework.samples.petclinic.owner.PetType;
import org.springframework.samples.petclinic.owner.PetTypeFormatter; import org.springframework.samples.petclinic.owner.PetTypeFormatter;
/** /**
* Test class for {@link PetTypeFormatter} * Test class for {@link PetTypeFormatter}
* *
* @author Colin But * @author Colin But
*/ */
@RunWith(MockitoJUnitRunner.class) @RunWith(MockitoJUnitRunner.class)
public class PetTypeFormatterTests { public class PetTypeFormatterTests {
@Mock @Mock
private PetRepository pets; private PetRepository pets;
private PetTypeFormatter petTypeFormatter; private PetTypeFormatter petTypeFormatter;
@Before @Before
public void setup() { public void setup() {
this.petTypeFormatter = new PetTypeFormatter(pets); this.petTypeFormatter = new PetTypeFormatter(pets);
} }
@Test @Test
public void testPrint() { public void testPrint() {
PetType petType = new PetType(); PetType petType = new PetType();
petType.setName("Hamster"); petType.setName("Hamster");
String petTypeName = this.petTypeFormatter.print(petType, Locale.ENGLISH); String petTypeName = this.petTypeFormatter.print(petType, Locale.ENGLISH);
assertEquals("Hamster", petTypeName); assertEquals("Hamster", petTypeName);
} }
@Test @Test
public void shouldParse() throws ParseException { public void shouldParse() throws ParseException {
Mockito.when(this.pets.findPetTypes()).thenReturn(makePetTypes()); Mockito.when(this.pets.findPetTypes()).thenReturn(makePetTypes());
PetType petType = petTypeFormatter.parse("Bird", Locale.ENGLISH); PetType petType = petTypeFormatter.parse("Bird", Locale.ENGLISH);
assertEquals("Bird", petType.getName()); assertEquals("Bird", petType.getName());
} }
@Test(expected = ParseException.class) @Test(expected = ParseException.class)
public void shouldThrowParseException() throws ParseException { public void shouldThrowParseException() throws ParseException {
Mockito.when(this.pets.findPetTypes()).thenReturn(makePetTypes()); Mockito.when(this.pets.findPetTypes()).thenReturn(makePetTypes());
petTypeFormatter.parse("Fish", Locale.ENGLISH); petTypeFormatter.parse("Fish", Locale.ENGLISH);
} }
/** /**
* Helper method to produce some sample pet types just for test purpose * Helper method to produce some sample pet types just for test purpose
* *
* @return {@link Collection} of {@link PetType} * @return {@link Collection} of {@link PetType}
*/ */
private List<PetType> makePetTypes() { private List<PetType> makePetTypes() {
List<PetType> petTypes = new ArrayList<>(); List<PetType> petTypes = new ArrayList<>();
petTypes.add(new PetType(){ petTypes.add(new PetType(){
{ {
setName("Dog"); setName("Dog");
} }
}); });
petTypes.add(new PetType(){ petTypes.add(new PetType(){
{ {
setName("Bird"); setName("Bird");
} }
}); });
return petTypes; return petTypes;
} }
} }

View file

@ -1,75 +1,75 @@
package org.springframework.samples.petclinic.owner; package org.springframework.samples.petclinic.owner;
import static org.mockito.BDDMockito.given; import static org.mockito.BDDMockito.given;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.model; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.model;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.view; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.view;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.samples.petclinic.owner.Pet; import org.springframework.samples.petclinic.owner.Pet;
import org.springframework.samples.petclinic.owner.PetRepository; import org.springframework.samples.petclinic.owner.PetRepository;
import org.springframework.samples.petclinic.owner.VisitController; import org.springframework.samples.petclinic.owner.VisitController;
import org.springframework.samples.petclinic.visit.VisitRepository; import org.springframework.samples.petclinic.visit.VisitRepository;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MockMvc;
/** /**
* Test class for {@link VisitController} * Test class for {@link VisitController}
* *
* @author Colin But * @author Colin But
*/ */
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@WebMvcTest(VisitController.class) @WebMvcTest(VisitController.class)
public class VisitControllerTests { public class VisitControllerTests {
private static final int TEST_PET_ID = 1; private static final int TEST_PET_ID = 1;
@Autowired @Autowired
private MockMvc mockMvc; private MockMvc mockMvc;
@MockBean @MockBean
private VisitRepository visits; private VisitRepository visits;
@MockBean @MockBean
private PetRepository pets; private PetRepository pets;
@Before @Before
public void init() { public void init() {
given(this.pets.findById(TEST_PET_ID)).willReturn(new Pet()); given(this.pets.findById(TEST_PET_ID)).willReturn(new Pet());
} }
@Test @Test
public void testInitNewVisitForm() throws Exception { public void testInitNewVisitForm() throws Exception {
mockMvc.perform(get("/owners/*/pets/{petId}/visits/new", TEST_PET_ID)) mockMvc.perform(get("/owners/*/pets/{petId}/visits/new", TEST_PET_ID))
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(view().name("pets/createOrUpdateVisitForm")); .andExpect(view().name("pets/createOrUpdateVisitForm"));
} }
@Test @Test
public void testProcessNewVisitFormSuccess() throws Exception { public void testProcessNewVisitFormSuccess() throws Exception {
mockMvc.perform(post("/owners/*/pets/{petId}/visits/new", TEST_PET_ID) mockMvc.perform(post("/owners/*/pets/{petId}/visits/new", TEST_PET_ID)
.param("name", "George") .param("name", "George")
.param("description", "Visit Description") .param("description", "Visit Description")
) )
.andExpect(status().is3xxRedirection()) .andExpect(status().is3xxRedirection())
.andExpect(view().name("redirect:/owners/{ownerId}")); .andExpect(view().name("redirect:/owners/{ownerId}"));
} }
@Test @Test
public void testProcessNewVisitFormHasErrors() throws Exception { public void testProcessNewVisitFormHasErrors() throws Exception {
mockMvc.perform(post("/owners/*/pets/{petId}/visits/new", TEST_PET_ID) mockMvc.perform(post("/owners/*/pets/{petId}/visits/new", TEST_PET_ID)
.param("name", "George") .param("name", "George")
) )
.andExpect(model().attributeHasErrors("visit")) .andExpect(model().attributeHasErrors("visit"))
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(view().name("pets/createOrUpdateVisitForm")); .andExpect(view().name("pets/createOrUpdateVisitForm"));
} }
} }

View file

@ -1,206 +1,206 @@
package org.springframework.samples.petclinic.service; package org.springframework.samples.petclinic.service;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import java.util.Collection; import java.util.Collection;
import java.util.Date; import java.util.Date;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import org.springframework.samples.petclinic.owner.Owner; import org.springframework.samples.petclinic.owner.Owner;
import org.springframework.samples.petclinic.owner.OwnerRepository; import org.springframework.samples.petclinic.owner.OwnerRepository;
import org.springframework.samples.petclinic.owner.Pet; import org.springframework.samples.petclinic.owner.Pet;
import org.springframework.samples.petclinic.owner.PetRepository; import org.springframework.samples.petclinic.owner.PetRepository;
import org.springframework.samples.petclinic.owner.PetType; import org.springframework.samples.petclinic.owner.PetType;
import org.springframework.samples.petclinic.vet.Vet; import org.springframework.samples.petclinic.vet.Vet;
import org.springframework.samples.petclinic.vet.VetRepository; import org.springframework.samples.petclinic.vet.VetRepository;
import org.springframework.samples.petclinic.visit.Visit; import org.springframework.samples.petclinic.visit.Visit;
import org.springframework.samples.petclinic.visit.VisitRepository; import org.springframework.samples.petclinic.visit.VisitRepository;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
/** /**
* Integration test of the Service and the Repository layer. * Integration test of the Service and the Repository layer.
* <p> * <p>
* ClinicServiceSpringDataJpaTests subclasses benefit from the following services provided by the Spring * ClinicServiceSpringDataJpaTests subclasses benefit from the following services provided by the Spring
* TestContext Framework: </p> <ul> <li><strong>Spring IoC container caching</strong> which spares us unnecessary set up * TestContext Framework: </p> <ul> <li><strong>Spring IoC container caching</strong> which spares us unnecessary set up
* time between test execution.</li> <li><strong>Dependency Injection</strong> of test fixture instances, meaning that * time between test execution.</li> <li><strong>Dependency Injection</strong> of test fixture instances, meaning that
* we don't need to perform application context lookups. See the use of {@link Autowired @Autowired} on the <code>{@link * we don't need to perform application context lookups. See the use of {@link Autowired @Autowired} on the <code>{@link
* ClinicServiceTests#clinicService clinicService}</code> instance variable, which uses autowiring <em>by * ClinicServiceTests#clinicService clinicService}</code> instance variable, which uses autowiring <em>by
* type</em>. <li><strong>Transaction management</strong>, meaning each test method is executed in its own transaction, * type</em>. <li><strong>Transaction management</strong>, meaning each test method is executed in its own transaction,
* which is automatically rolled back by default. Thus, even if tests insert or otherwise change database state, there * which is automatically rolled back by default. Thus, even if tests insert or otherwise change database state, there
* is no need for a teardown or cleanup script. <li> An {@link org.springframework.context.ApplicationContext * is no need for a teardown or cleanup script. <li> An {@link org.springframework.context.ApplicationContext
* ApplicationContext} is also inherited and can be used for explicit bean lookup if necessary. </li> </ul> * ApplicationContext} is also inherited and can be used for explicit bean lookup if necessary. </li> </ul>
* *
* @author Ken Krebs * @author Ken Krebs
* @author Rod Johnson * @author Rod Johnson
* @author Juergen Hoeller * @author Juergen Hoeller
* @author Sam Brannen * @author Sam Brannen
* @author Michael Isvy * @author Michael Isvy
* @author Dave Syer * @author Dave Syer
*/ */
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@DataJpaTest(includeFilters = @ComponentScan.Filter(Service.class)) @DataJpaTest(includeFilters = @ComponentScan.Filter(Service.class))
public class ClinicServiceTests { public class ClinicServiceTests {
@Autowired @Autowired
protected OwnerRepository owners; protected OwnerRepository owners;
@Autowired @Autowired
protected PetRepository pets; protected PetRepository pets;
@Autowired @Autowired
protected VisitRepository visits; protected VisitRepository visits;
@Autowired @Autowired
protected VetRepository vets; protected VetRepository vets;
@Test @Test
public void shouldFindOwnersByLastName() { public void shouldFindOwnersByLastName() {
Collection<Owner> owners = this.owners.findByLastName("Davis"); Collection<Owner> owners = this.owners.findByLastName("Davis");
assertThat(owners.size()).isEqualTo(2); assertThat(owners.size()).isEqualTo(2);
owners = this.owners.findByLastName("Daviss"); owners = this.owners.findByLastName("Daviss");
assertThat(owners.isEmpty()).isTrue(); assertThat(owners.isEmpty()).isTrue();
} }
@Test @Test
public void shouldFindSingleOwnerWithPet() { public void shouldFindSingleOwnerWithPet() {
Owner owner = this.owners.findById(1); Owner owner = this.owners.findById(1);
assertThat(owner.getLastName()).startsWith("Franklin"); assertThat(owner.getLastName()).startsWith("Franklin");
assertThat(owner.getPets().size()).isEqualTo(1); assertThat(owner.getPets().size()).isEqualTo(1);
assertThat(owner.getPets().get(0).getType()).isNotNull(); assertThat(owner.getPets().get(0).getType()).isNotNull();
assertThat(owner.getPets().get(0).getType().getName()).isEqualTo("cat"); assertThat(owner.getPets().get(0).getType().getName()).isEqualTo("cat");
} }
@Test @Test
@Transactional @Transactional
public void shouldInsertOwner() { public void shouldInsertOwner() {
Collection<Owner> owners = this.owners.findByLastName("Schultz"); Collection<Owner> owners = this.owners.findByLastName("Schultz");
int found = owners.size(); int found = owners.size();
Owner owner = new Owner(); Owner owner = new Owner();
owner.setFirstName("Sam"); owner.setFirstName("Sam");
owner.setLastName("Schultz"); owner.setLastName("Schultz");
owner.setAddress("4, Evans Street"); owner.setAddress("4, Evans Street");
owner.setCity("Wollongong"); owner.setCity("Wollongong");
owner.setTelephone("4444444444"); owner.setTelephone("4444444444");
this.owners.save(owner); this.owners.save(owner);
assertThat(owner.getId().longValue()).isNotEqualTo(0); assertThat(owner.getId().longValue()).isNotEqualTo(0);
owners = this.owners.findByLastName("Schultz"); owners = this.owners.findByLastName("Schultz");
assertThat(owners.size()).isEqualTo(found + 1); assertThat(owners.size()).isEqualTo(found + 1);
} }
@Test @Test
@Transactional @Transactional
public void shouldUpdateOwner() { public void shouldUpdateOwner() {
Owner owner = this.owners.findById(1); Owner owner = this.owners.findById(1);
String oldLastName = owner.getLastName(); String oldLastName = owner.getLastName();
String newLastName = oldLastName + "X"; String newLastName = oldLastName + "X";
owner.setLastName(newLastName); owner.setLastName(newLastName);
this.owners.save(owner); this.owners.save(owner);
// retrieving new name from database // retrieving new name from database
owner = this.owners.findById(1); owner = this.owners.findById(1);
assertThat(owner.getLastName()).isEqualTo(newLastName); assertThat(owner.getLastName()).isEqualTo(newLastName);
} }
@Test @Test
public void shouldFindPetWithCorrectId() { public void shouldFindPetWithCorrectId() {
Pet pet7 = this.pets.findById(7); Pet pet7 = this.pets.findById(7);
assertThat(pet7.getName()).startsWith("Samantha"); assertThat(pet7.getName()).startsWith("Samantha");
assertThat(pet7.getOwner().getFirstName()).isEqualTo("Jean"); assertThat(pet7.getOwner().getFirstName()).isEqualTo("Jean");
} }
@Test @Test
public void shouldFindAllPetTypes() { public void shouldFindAllPetTypes() {
Collection<PetType> petTypes = this.pets.findPetTypes(); Collection<PetType> petTypes = this.pets.findPetTypes();
PetType petType1 = EntityUtils.getById(petTypes, PetType.class, 1); PetType petType1 = EntityUtils.getById(petTypes, PetType.class, 1);
assertThat(petType1.getName()).isEqualTo("cat"); assertThat(petType1.getName()).isEqualTo("cat");
PetType petType4 = EntityUtils.getById(petTypes, PetType.class, 4); PetType petType4 = EntityUtils.getById(petTypes, PetType.class, 4);
assertThat(petType4.getName()).isEqualTo("snake"); assertThat(petType4.getName()).isEqualTo("snake");
} }
@Test @Test
@Transactional @Transactional
public void shouldInsertPetIntoDatabaseAndGenerateId() { public void shouldInsertPetIntoDatabaseAndGenerateId() {
Owner owner6 = this.owners.findById(6); Owner owner6 = this.owners.findById(6);
int found = owner6.getPets().size(); int found = owner6.getPets().size();
Pet pet = new Pet(); Pet pet = new Pet();
pet.setName("bowser"); pet.setName("bowser");
Collection<PetType> types = this.pets.findPetTypes(); Collection<PetType> types = this.pets.findPetTypes();
pet.setType(EntityUtils.getById(types, PetType.class, 2)); pet.setType(EntityUtils.getById(types, PetType.class, 2));
pet.setBirthDate(new Date()); pet.setBirthDate(new Date());
owner6.addPet(pet); owner6.addPet(pet);
assertThat(owner6.getPets().size()).isEqualTo(found + 1); assertThat(owner6.getPets().size()).isEqualTo(found + 1);
this.pets.save(pet); this.pets.save(pet);
this.owners.save(owner6); this.owners.save(owner6);
owner6 = this.owners.findById(6); owner6 = this.owners.findById(6);
assertThat(owner6.getPets().size()).isEqualTo(found + 1); assertThat(owner6.getPets().size()).isEqualTo(found + 1);
// checks that id has been generated // checks that id has been generated
assertThat(pet.getId()).isNotNull(); assertThat(pet.getId()).isNotNull();
} }
@Test @Test
@Transactional @Transactional
public void shouldUpdatePetName() throws Exception { public void shouldUpdatePetName() throws Exception {
Pet pet7 = this.pets.findById(7); Pet pet7 = this.pets.findById(7);
String oldName = pet7.getName(); String oldName = pet7.getName();
String newName = oldName + "X"; String newName = oldName + "X";
pet7.setName(newName); pet7.setName(newName);
this.pets.save(pet7); this.pets.save(pet7);
pet7 = this.pets.findById(7); pet7 = this.pets.findById(7);
assertThat(pet7.getName()).isEqualTo(newName); assertThat(pet7.getName()).isEqualTo(newName);
} }
@Test @Test
public void shouldFindVets() { public void shouldFindVets() {
Collection<Vet> vets = this.vets.findAll(); Collection<Vet> vets = this.vets.findAll();
Vet vet = EntityUtils.getById(vets, Vet.class, 3); Vet vet = EntityUtils.getById(vets, Vet.class, 3);
assertThat(vet.getLastName()).isEqualTo("Douglas"); assertThat(vet.getLastName()).isEqualTo("Douglas");
assertThat(vet.getNrOfSpecialties()).isEqualTo(2); assertThat(vet.getNrOfSpecialties()).isEqualTo(2);
assertThat(vet.getSpecialties().get(0).getName()).isEqualTo("dentistry"); assertThat(vet.getSpecialties().get(0).getName()).isEqualTo("dentistry");
assertThat(vet.getSpecialties().get(1).getName()).isEqualTo("surgery"); assertThat(vet.getSpecialties().get(1).getName()).isEqualTo("surgery");
} }
@Test @Test
@Transactional @Transactional
public void shouldAddNewVisitForPet() { public void shouldAddNewVisitForPet() {
Pet pet7 = this.pets.findById(7); Pet pet7 = this.pets.findById(7);
int found = pet7.getVisits().size(); int found = pet7.getVisits().size();
Visit visit = new Visit(); Visit visit = new Visit();
pet7.addVisit(visit); pet7.addVisit(visit);
visit.setDescription("test"); visit.setDescription("test");
this.visits.save(visit); this.visits.save(visit);
this.pets.save(pet7); this.pets.save(pet7);
pet7 = this.pets.findById(7); pet7 = this.pets.findById(7);
assertThat(pet7.getVisits().size()).isEqualTo(found + 1); assertThat(pet7.getVisits().size()).isEqualTo(found + 1);
assertThat(visit.getId()).isNotNull(); assertThat(visit.getId()).isNotNull();
} }
@Test @Test
public void shouldFindVisitsByPetId() throws Exception { public void shouldFindVisitsByPetId() throws Exception {
Collection<Visit> visits = this.visits.findByPetId(7); Collection<Visit> visits = this.visits.findByPetId(7);
assertThat(visits.size()).isEqualTo(2); assertThat(visits.size()).isEqualTo(2);
Visit[] visitArr = visits.toArray(new Visit[visits.size()]); Visit[] visitArr = visits.toArray(new Visit[visits.size()]);
assertThat(visitArr[0].getDate()).isNotNull(); assertThat(visitArr[0].getDate()).isNotNull();
assertThat(visitArr[0].getPetId()).isEqualTo(7); assertThat(visitArr[0].getPetId()).isEqualTo(7);
} }
} }

View file

@ -1,54 +1,54 @@
/* /*
* Copyright 2002-2013 the original author or authors. * Copyright 2002-2013 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.samples.petclinic.service; package org.springframework.samples.petclinic.service;
import java.util.Collection; import java.util.Collection;
import org.springframework.orm.ObjectRetrievalFailureException; import org.springframework.orm.ObjectRetrievalFailureException;
import org.springframework.samples.petclinic.model.BaseEntity; import org.springframework.samples.petclinic.model.BaseEntity;
/** /**
* Utility methods for handling entities. Separate from the BaseEntity class mainly because of dependency on the * Utility methods for handling entities. Separate from the BaseEntity class mainly because of dependency on the
* ORM-associated ObjectRetrievalFailureException. * ORM-associated ObjectRetrievalFailureException.
* *
* @author Juergen Hoeller * @author Juergen Hoeller
* @author Sam Brannen * @author Sam Brannen
* @see org.springframework.samples.petclinic.model.BaseEntity * @see org.springframework.samples.petclinic.model.BaseEntity
* @since 29.10.2003 * @since 29.10.2003
*/ */
public abstract class EntityUtils { public abstract class EntityUtils {
/** /**
* Look up the entity of the given class with the given id in the given collection. * Look up the entity of the given class with the given id in the given collection.
* *
* @param entities the collection to search * @param entities the collection to search
* @param entityClass the entity class to look up * @param entityClass the entity class to look up
* @param entityId the entity id to look up * @param entityId the entity id to look up
* @return the found entity * @return the found entity
* @throws ObjectRetrievalFailureException if the entity was not found * @throws ObjectRetrievalFailureException if the entity was not found
*/ */
public static <T extends BaseEntity> T getById(Collection<T> entities, Class<T> entityClass, int entityId) public static <T extends BaseEntity> T getById(Collection<T> entities, Class<T> entityClass, int entityId)
throws ObjectRetrievalFailureException { throws ObjectRetrievalFailureException {
for (T entity : entities) { for (T entity : entities) {
if (entity.getId() == entityId && entityClass.isInstance(entity)) { if (entity.getId() == entityId && entityClass.isInstance(entity)) {
return entity; return entity;
} }
} }
throw new ObjectRetrievalFailureException(entityClass, entityId); throw new ObjectRetrievalFailureException(entityClass, entityId);
} }
} }

View file

@ -1,38 +1,38 @@
package org.springframework.samples.petclinic.system; package org.springframework.samples.petclinic.system;
import org.junit.Ignore; import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MockMvc;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.forwardedUrl; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.forwardedUrl;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.model; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.model;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.view; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.view;
/** /**
* Test class for {@link CrashController} * Test class for {@link CrashController}
* *
* @author Colin But * @author Colin But
*/ */
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
// Waiting https://github.com/spring-projects/spring-boot/issues/5574 // Waiting https://github.com/spring-projects/spring-boot/issues/5574
@Ignore @Ignore
@WebMvcTest(controllers = CrashController.class) @WebMvcTest(controllers = CrashController.class)
public class CrashControllerTests { public class CrashControllerTests {
@Autowired @Autowired
private MockMvc mockMvc; private MockMvc mockMvc;
@Test @Test
public void testTriggerException() throws Exception { public void testTriggerException() throws Exception {
mockMvc.perform(get("/oups")).andExpect(view().name("exception")) mockMvc.perform(get("/oups")).andExpect(view().name("exception"))
.andExpect(model().attributeExists("exception")) .andExpect(model().attributeExists("exception"))
.andExpect(forwardedUrl("exception")).andExpect(status().isOk()); .andExpect(forwardedUrl("exception")).andExpect(status().isOk());
} }
} }

View file

@ -1,23 +1,23 @@
package org.springframework.samples.petclinic.system; package org.springframework.samples.petclinic.system;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.samples.petclinic.vet.VetRepository; import org.springframework.samples.petclinic.vet.VetRepository;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest @SpringBootTest
public class ProductionConfigurationTests { public class ProductionConfigurationTests {
@Autowired @Autowired
private VetRepository vets; private VetRepository vets;
@Test @Test
public void testFindAll() throws Exception { public void testFindAll() throws Exception {
vets.findAll(); vets.findAll();
vets.findAll(); // served from cache vets.findAll(); // served from cache
} }
} }

View file

@ -1,82 +1,82 @@
package org.springframework.samples.petclinic.vet; package org.springframework.samples.petclinic.vet;
import static org.hamcrest.xml.HasXPath.hasXPath; import static org.hamcrest.xml.HasXPath.hasXPath;
import static org.mockito.BDDMockito.given; import static org.mockito.BDDMockito.given;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.model; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.model;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.view; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.view;
import org.assertj.core.util.Lists; import org.assertj.core.util.Lists;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.samples.petclinic.vet.Specialty; import org.springframework.samples.petclinic.vet.Specialty;
import org.springframework.samples.petclinic.vet.Vet; import org.springframework.samples.petclinic.vet.Vet;
import org.springframework.samples.petclinic.vet.VetController; import org.springframework.samples.petclinic.vet.VetController;
import org.springframework.samples.petclinic.vet.VetRepository; import org.springframework.samples.petclinic.vet.VetRepository;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.ResultActions; import org.springframework.test.web.servlet.ResultActions;
/** /**
* Test class for the {@link VetController} * Test class for the {@link VetController}
*/ */
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@WebMvcTest(VetController.class) @WebMvcTest(VetController.class)
public class VetControllerTests { public class VetControllerTests {
@Autowired @Autowired
private MockMvc mockMvc; private MockMvc mockMvc;
@MockBean @MockBean
private VetRepository vets; private VetRepository vets;
@Before @Before
public void setup() { public void setup() {
Vet james = new Vet(); Vet james = new Vet();
james.setFirstName("James"); james.setFirstName("James");
james.setLastName("Carter"); james.setLastName("Carter");
james.setId(1); james.setId(1);
Vet helen = new Vet(); Vet helen = new Vet();
helen.setFirstName("Helen"); helen.setFirstName("Helen");
helen.setLastName("Leary"); helen.setLastName("Leary");
helen.setId(2); helen.setId(2);
Specialty radiology = new Specialty(); Specialty radiology = new Specialty();
radiology.setId(1); radiology.setId(1);
radiology.setName("radiology"); radiology.setName("radiology");
helen.addSpecialty(radiology); helen.addSpecialty(radiology);
given(this.vets.findAll()).willReturn(Lists.newArrayList(james, helen)); given(this.vets.findAll()).willReturn(Lists.newArrayList(james, helen));
} }
@Test @Test
public void testShowVetListHtml() throws Exception { public void testShowVetListHtml() throws Exception {
mockMvc.perform(get("/vets.html")) mockMvc.perform(get("/vets.html"))
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(model().attributeExists("vets")) .andExpect(model().attributeExists("vets"))
.andExpect(view().name("vets/vetList")); .andExpect(view().name("vets/vetList"));
} }
@Test @Test
public void testShowResourcesVetList() throws Exception { public void testShowResourcesVetList() throws Exception {
ResultActions actions = mockMvc.perform(get("/vets.json").accept(MediaType.APPLICATION_JSON)) ResultActions actions = mockMvc.perform(get("/vets.json").accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk()); .andExpect(status().isOk());
actions.andExpect(content().contentType("application/json;charset=UTF-8")) actions.andExpect(content().contentType("application/json;charset=UTF-8"))
.andExpect(jsonPath("$.vetList[0].id").value(1)); .andExpect(jsonPath("$.vetList[0].id").value(1));
} }
@Test @Test
public void testShowVetListXml() throws Exception { public void testShowVetListXml() throws Exception {
mockMvc.perform(get("/vets.xml").accept(MediaType.APPLICATION_XML)) mockMvc.perform(get("/vets.xml").accept(MediaType.APPLICATION_XML))
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_XML_VALUE)) .andExpect(content().contentType(MediaType.APPLICATION_XML_VALUE))
.andExpect(content().node(hasXPath("/vets/vetList[id=1]/id"))); .andExpect(content().node(hasXPath("/vets/vetList[id=1]/id")));
} }
} }

View file

@ -1,43 +1,43 @@
/* /*
* Copyright 2016-2017 the original author or authors. * Copyright 2016-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.samples.petclinic.vet; package org.springframework.samples.petclinic.vet;
import org.junit.Test; import org.junit.Test;
import org.springframework.util.SerializationUtils; import org.springframework.util.SerializationUtils;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
/** /**
* @author Dave Syer * @author Dave Syer
* *
*/ */
public class VetTests { public class VetTests {
@Test @Test
public void testSerialization() { public void testSerialization() {
Vet vet = new Vet(); Vet vet = new Vet();
vet.setFirstName("Zaphod"); vet.setFirstName("Zaphod");
vet.setLastName("Beeblebrox"); vet.setLastName("Beeblebrox");
vet.setId(123); vet.setId(123);
Vet other = (Vet) SerializationUtils Vet other = (Vet) SerializationUtils
.deserialize(SerializationUtils.serialize(vet)); .deserialize(SerializationUtils.serialize(vet));
assertThat(other.getFirstName()).isEqualTo(vet.getFirstName()); assertThat(other.getFirstName()).isEqualTo(vet.getFirstName());
assertThat(other.getLastName()).isEqualTo(vet.getLastName()); assertThat(other.getLastName()).isEqualTo(vet.getLastName());
assertThat(other.getId()).isEqualTo(vet.getId()); assertThat(other.getId()).isEqualTo(vet.getId());
} }
} }

View file

@ -1,411 +1,411 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="2.8" jmeter="2.13 r1665067"> <jmeterTestPlan version="1.2" properties="2.8" jmeter="2.13 r1665067">
<hashTree> <hashTree>
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true"> <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
<stringProp name="TestPlan.comments"></stringProp> <stringProp name="TestPlan.comments"></stringProp>
<boolProp name="TestPlan.functional_mode">false</boolProp> <boolProp name="TestPlan.functional_mode">false</boolProp>
<boolProp name="TestPlan.serialize_threadgroups">false</boolProp> <boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="Variables pr<70>-d<>finies" enabled="true"> <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="Variables pr<70>-d<>finies" enabled="true">
<collectionProp name="Arguments.arguments"> <collectionProp name="Arguments.arguments">
<elementProp name="PETCLINIC_HOST" elementType="Argument"> <elementProp name="PETCLINIC_HOST" elementType="Argument">
<stringProp name="Argument.name">PETCLINIC_HOST</stringProp> <stringProp name="Argument.name">PETCLINIC_HOST</stringProp>
<stringProp name="Argument.value">localhost</stringProp> <stringProp name="Argument.value">localhost</stringProp>
<stringProp name="Argument.metadata">=</stringProp> <stringProp name="Argument.metadata">=</stringProp>
</elementProp> </elementProp>
<elementProp name="PETCLINIC_PORT" elementType="Argument"> <elementProp name="PETCLINIC_PORT" elementType="Argument">
<stringProp name="Argument.name">PETCLINIC_PORT</stringProp> <stringProp name="Argument.name">PETCLINIC_PORT</stringProp>
<stringProp name="Argument.value">8080</stringProp> <stringProp name="Argument.value">8080</stringProp>
<stringProp name="Argument.metadata">=</stringProp> <stringProp name="Argument.metadata">=</stringProp>
</elementProp> </elementProp>
<elementProp name="CONTEXT_WEB" elementType="Argument"> <elementProp name="CONTEXT_WEB" elementType="Argument">
<stringProp name="Argument.name">CONTEXT_WEB</stringProp> <stringProp name="Argument.name">CONTEXT_WEB</stringProp>
<stringProp name="Argument.value"></stringProp> <stringProp name="Argument.value"></stringProp>
<stringProp name="Argument.metadata">=</stringProp> <stringProp name="Argument.metadata">=</stringProp>
</elementProp> </elementProp>
</collectionProp> </collectionProp>
</elementProp> </elementProp>
<stringProp name="TestPlan.user_define_classpath"></stringProp> <stringProp name="TestPlan.user_define_classpath"></stringProp>
</TestPlan> </TestPlan>
<hashTree> <hashTree>
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="User threads" enabled="true"> <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="User threads" enabled="true">
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp> <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
<elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Contr<74>leur Boucle" enabled="true"> <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Contr<74>leur Boucle" enabled="true">
<boolProp name="LoopController.continue_forever">false</boolProp> <boolProp name="LoopController.continue_forever">false</boolProp>
<stringProp name="LoopController.loops">10</stringProp> <stringProp name="LoopController.loops">10</stringProp>
</elementProp> </elementProp>
<stringProp name="ThreadGroup.num_threads">500</stringProp> <stringProp name="ThreadGroup.num_threads">500</stringProp>
<stringProp name="ThreadGroup.ramp_time">10</stringProp> <stringProp name="ThreadGroup.ramp_time">10</stringProp>
<longProp name="ThreadGroup.start_time">1361531541000</longProp> <longProp name="ThreadGroup.start_time">1361531541000</longProp>
<longProp name="ThreadGroup.end_time">1361531541000</longProp> <longProp name="ThreadGroup.end_time">1361531541000</longProp>
<boolProp name="ThreadGroup.scheduler">false</boolProp> <boolProp name="ThreadGroup.scheduler">false</boolProp>
<stringProp name="ThreadGroup.duration"></stringProp> <stringProp name="ThreadGroup.duration"></stringProp>
<stringProp name="ThreadGroup.delay"></stringProp> <stringProp name="ThreadGroup.delay"></stringProp>
<boolProp name="ThreadGroup.delayedStart">true</boolProp> <boolProp name="ThreadGroup.delayedStart">true</boolProp>
<stringProp name="TestPlan.comments">Original : 500 - 10 - 10</stringProp> <stringProp name="TestPlan.comments">Original : 500 - 10 - 10</stringProp>
</ThreadGroup> </ThreadGroup>
<hashTree> <hashTree>
<ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="Fixed time counter" enabled="true"> <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="Fixed time counter" enabled="true">
<stringProp name="ConstantTimer.delay">300</stringProp> <stringProp name="ConstantTimer.delay">300</stringProp>
</ConstantTimer> </ConstantTimer>
<hashTree/> <hashTree/>
<ConfigTestElement guiclass="HttpDefaultsGui" testclass="ConfigTestElement" testname="Default HTTP parameters" enabled="true"> <ConfigTestElement guiclass="HttpDefaultsGui" testclass="ConfigTestElement" testname="Default HTTP parameters" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="Variables pr<70>-d<>finies" enabled="true"> <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="Variables pr<70>-d<>finies" enabled="true">
<collectionProp name="Arguments.arguments"/> <collectionProp name="Arguments.arguments"/>
</elementProp> </elementProp>
<stringProp name="HTTPSampler.domain">${PETCLINIC_HOST}</stringProp> <stringProp name="HTTPSampler.domain">${PETCLINIC_HOST}</stringProp>
<stringProp name="HTTPSampler.port">${PETCLINIC_PORT}</stringProp> <stringProp name="HTTPSampler.port">${PETCLINIC_PORT}</stringProp>
<stringProp name="HTTPSampler.connect_timeout"></stringProp> <stringProp name="HTTPSampler.connect_timeout"></stringProp>
<stringProp name="HTTPSampler.response_timeout"></stringProp> <stringProp name="HTTPSampler.response_timeout"></stringProp>
<stringProp name="HTTPSampler.protocol"></stringProp> <stringProp name="HTTPSampler.protocol"></stringProp>
<stringProp name="HTTPSampler.contentEncoding"></stringProp> <stringProp name="HTTPSampler.contentEncoding"></stringProp>
<stringProp name="HTTPSampler.path"></stringProp> <stringProp name="HTTPSampler.path"></stringProp>
<stringProp name="HTTPSampler.concurrentPool">4</stringProp> <stringProp name="HTTPSampler.concurrentPool">4</stringProp>
</ConfigTestElement> </ConfigTestElement>
<hashTree/> <hashTree/>
<CookieManager guiclass="CookiePanel" testclass="CookieManager" testname="HTTP cookie manager" enabled="true"> <CookieManager guiclass="CookiePanel" testclass="CookieManager" testname="HTTP cookie manager" enabled="true">
<collectionProp name="CookieManager.cookies"/> <collectionProp name="CookieManager.cookies"/>
<boolProp name="CookieManager.clearEachIteration">true</boolProp> <boolProp name="CookieManager.clearEachIteration">true</boolProp>
</CookieManager> </CookieManager>
<hashTree/> <hashTree/>
<CounterConfig guiclass="CounterConfigGui" testclass="CounterConfig" testname="User Count" enabled="true"> <CounterConfig guiclass="CounterConfigGui" testclass="CounterConfig" testname="User Count" enabled="true">
<stringProp name="CounterConfig.start">1</stringProp> <stringProp name="CounterConfig.start">1</stringProp>
<stringProp name="CounterConfig.end">10</stringProp> <stringProp name="CounterConfig.end">10</stringProp>
<stringProp name="CounterConfig.incr">1</stringProp> <stringProp name="CounterConfig.incr">1</stringProp>
<stringProp name="CounterConfig.name">count</stringProp> <stringProp name="CounterConfig.name">count</stringProp>
<stringProp name="CounterConfig.format"></stringProp> <stringProp name="CounterConfig.format"></stringProp>
<boolProp name="CounterConfig.per_user">false</boolProp> <boolProp name="CounterConfig.per_user">false</boolProp>
</CounterConfig> </CounterConfig>
<hashTree/> <hashTree/>
<CounterConfig guiclass="CounterConfigGui" testclass="CounterConfig" testname="Pet Count" enabled="true"> <CounterConfig guiclass="CounterConfigGui" testclass="CounterConfig" testname="Pet Count" enabled="true">
<stringProp name="CounterConfig.start">1</stringProp> <stringProp name="CounterConfig.start">1</stringProp>
<stringProp name="CounterConfig.end">13</stringProp> <stringProp name="CounterConfig.end">13</stringProp>
<stringProp name="CounterConfig.incr">1</stringProp> <stringProp name="CounterConfig.incr">1</stringProp>
<stringProp name="CounterConfig.name">petCount</stringProp> <stringProp name="CounterConfig.name">petCount</stringProp>
<stringProp name="CounterConfig.format"></stringProp> <stringProp name="CounterConfig.format"></stringProp>
<boolProp name="CounterConfig.per_user">false</boolProp> <boolProp name="CounterConfig.per_user">false</boolProp>
</CounterConfig> </CounterConfig>
<hashTree/> <hashTree/>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Home page" enabled="true"> <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Home page" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="Variables pr<70>-d<>finies" enabled="true"> <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="Variables pr<70>-d<>finies" enabled="true">
<collectionProp name="Arguments.arguments"/> <collectionProp name="Arguments.arguments"/>
</elementProp> </elementProp>
<stringProp name="HTTPSampler.domain"></stringProp> <stringProp name="HTTPSampler.domain"></stringProp>
<stringProp name="HTTPSampler.port"></stringProp> <stringProp name="HTTPSampler.port"></stringProp>
<stringProp name="HTTPSampler.connect_timeout"></stringProp> <stringProp name="HTTPSampler.connect_timeout"></stringProp>
<stringProp name="HTTPSampler.response_timeout"></stringProp> <stringProp name="HTTPSampler.response_timeout"></stringProp>
<stringProp name="HTTPSampler.protocol"></stringProp> <stringProp name="HTTPSampler.protocol"></stringProp>
<stringProp name="HTTPSampler.contentEncoding"></stringProp> <stringProp name="HTTPSampler.contentEncoding"></stringProp>
<stringProp name="HTTPSampler.path">${CONTEXT_WEB}/</stringProp> <stringProp name="HTTPSampler.path">${CONTEXT_WEB}/</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp> <stringProp name="HTTPSampler.method">GET</stringProp>
<boolProp name="HTTPSampler.follow_redirects">true</boolProp> <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp> <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp> <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
<boolProp name="HTTPSampler.monitor">false</boolProp> <boolProp name="HTTPSampler.monitor">false</boolProp>
<stringProp name="HTTPSampler.embedded_url_re"></stringProp> <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
</HTTPSamplerProxy> </HTTPSamplerProxy>
<hashTree/> <hashTree/>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="CSS" enabled="true"> <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="CSS" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="Variables pr<70>-d<>finies" enabled="true"> <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="Variables pr<70>-d<>finies" enabled="true">
<collectionProp name="Arguments.arguments"/> <collectionProp name="Arguments.arguments"/>
</elementProp> </elementProp>
<stringProp name="HTTPSampler.domain"></stringProp> <stringProp name="HTTPSampler.domain"></stringProp>
<stringProp name="HTTPSampler.port"></stringProp> <stringProp name="HTTPSampler.port"></stringProp>
<stringProp name="HTTPSampler.connect_timeout"></stringProp> <stringProp name="HTTPSampler.connect_timeout"></stringProp>
<stringProp name="HTTPSampler.response_timeout"></stringProp> <stringProp name="HTTPSampler.response_timeout"></stringProp>
<stringProp name="HTTPSampler.protocol"></stringProp> <stringProp name="HTTPSampler.protocol"></stringProp>
<stringProp name="HTTPSampler.contentEncoding"></stringProp> <stringProp name="HTTPSampler.contentEncoding"></stringProp>
<stringProp name="HTTPSampler.path">${CONTEXT_WEB}/resources/css/petclinic.css</stringProp> <stringProp name="HTTPSampler.path">${CONTEXT_WEB}/resources/css/petclinic.css</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp> <stringProp name="HTTPSampler.method">GET</stringProp>
<boolProp name="HTTPSampler.follow_redirects">true</boolProp> <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp> <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp> <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
<boolProp name="HTTPSampler.monitor">false</boolProp> <boolProp name="HTTPSampler.monitor">false</boolProp>
<stringProp name="HTTPSampler.embedded_url_re"></stringProp> <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
</HTTPSamplerProxy> </HTTPSamplerProxy>
<hashTree/> <hashTree/>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="JS" enabled="true"> <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="JS" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="Variables pr<70>-d<>finies" enabled="true"> <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="Variables pr<70>-d<>finies" enabled="true">
<collectionProp name="Arguments.arguments"/> <collectionProp name="Arguments.arguments"/>
</elementProp> </elementProp>
<stringProp name="HTTPSampler.domain"></stringProp> <stringProp name="HTTPSampler.domain"></stringProp>
<stringProp name="HTTPSampler.port"></stringProp> <stringProp name="HTTPSampler.port"></stringProp>
<stringProp name="HTTPSampler.connect_timeout"></stringProp> <stringProp name="HTTPSampler.connect_timeout"></stringProp>
<stringProp name="HTTPSampler.response_timeout"></stringProp> <stringProp name="HTTPSampler.response_timeout"></stringProp>
<stringProp name="HTTPSampler.protocol"></stringProp> <stringProp name="HTTPSampler.protocol"></stringProp>
<stringProp name="HTTPSampler.contentEncoding"></stringProp> <stringProp name="HTTPSampler.contentEncoding"></stringProp>
<stringProp name="HTTPSampler.path">${CONTEXT_WEB}/vendors/jquery/jquery.js</stringProp> <stringProp name="HTTPSampler.path">${CONTEXT_WEB}/vendors/jquery/jquery.js</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp> <stringProp name="HTTPSampler.method">GET</stringProp>
<boolProp name="HTTPSampler.follow_redirects">true</boolProp> <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp> <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp> <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
<boolProp name="HTTPSampler.monitor">false</boolProp> <boolProp name="HTTPSampler.monitor">false</boolProp>
<stringProp name="HTTPSampler.embedded_url_re"></stringProp> <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
</HTTPSamplerProxy> </HTTPSamplerProxy>
<hashTree/> <hashTree/>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Vets" enabled="true"> <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Vets" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="Variables pr<70>-d<>finies" enabled="true"> <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="Variables pr<70>-d<>finies" enabled="true">
<collectionProp name="Arguments.arguments"/> <collectionProp name="Arguments.arguments"/>
</elementProp> </elementProp>
<stringProp name="HTTPSampler.domain"></stringProp> <stringProp name="HTTPSampler.domain"></stringProp>
<stringProp name="HTTPSampler.port"></stringProp> <stringProp name="HTTPSampler.port"></stringProp>
<stringProp name="HTTPSampler.connect_timeout"></stringProp> <stringProp name="HTTPSampler.connect_timeout"></stringProp>
<stringProp name="HTTPSampler.response_timeout"></stringProp> <stringProp name="HTTPSampler.response_timeout"></stringProp>
<stringProp name="HTTPSampler.protocol"></stringProp> <stringProp name="HTTPSampler.protocol"></stringProp>
<stringProp name="HTTPSampler.contentEncoding"></stringProp> <stringProp name="HTTPSampler.contentEncoding"></stringProp>
<stringProp name="HTTPSampler.path">${CONTEXT_WEB}/vets.html</stringProp> <stringProp name="HTTPSampler.path">${CONTEXT_WEB}/vets.html</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp> <stringProp name="HTTPSampler.method">GET</stringProp>
<boolProp name="HTTPSampler.follow_redirects">true</boolProp> <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp> <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp> <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
<boolProp name="HTTPSampler.monitor">false</boolProp> <boolProp name="HTTPSampler.monitor">false</boolProp>
<stringProp name="HTTPSampler.embedded_url_re"></stringProp> <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
</HTTPSamplerProxy> </HTTPSamplerProxy>
<hashTree/> <hashTree/>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Find owner" enabled="true"> <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Find owner" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="Variables pr<70>-d<>finies" enabled="true"> <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="Variables pr<70>-d<>finies" enabled="true">
<collectionProp name="Arguments.arguments"/> <collectionProp name="Arguments.arguments"/>
</elementProp> </elementProp>
<stringProp name="HTTPSampler.domain"></stringProp> <stringProp name="HTTPSampler.domain"></stringProp>
<stringProp name="HTTPSampler.port"></stringProp> <stringProp name="HTTPSampler.port"></stringProp>
<stringProp name="HTTPSampler.connect_timeout"></stringProp> <stringProp name="HTTPSampler.connect_timeout"></stringProp>
<stringProp name="HTTPSampler.response_timeout"></stringProp> <stringProp name="HTTPSampler.response_timeout"></stringProp>
<stringProp name="HTTPSampler.protocol"></stringProp> <stringProp name="HTTPSampler.protocol"></stringProp>
<stringProp name="HTTPSampler.contentEncoding"></stringProp> <stringProp name="HTTPSampler.contentEncoding"></stringProp>
<stringProp name="HTTPSampler.path">${CONTEXT_WEB}/owners/find.html</stringProp> <stringProp name="HTTPSampler.path">${CONTEXT_WEB}/owners/find.html</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp> <stringProp name="HTTPSampler.method">GET</stringProp>
<boolProp name="HTTPSampler.follow_redirects">true</boolProp> <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp> <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp> <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
<boolProp name="HTTPSampler.monitor">false</boolProp> <boolProp name="HTTPSampler.monitor">false</boolProp>
<stringProp name="HTTPSampler.embedded_url_re"></stringProp> <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
</HTTPSamplerProxy> </HTTPSamplerProxy>
<hashTree/> <hashTree/>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Find owner with lastname=&quot;&quot;" enabled="true"> <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Find owner with lastname=&quot;&quot;" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="Variables pr<70>-d<>finies" enabled="true"> <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="Variables pr<70>-d<>finies" enabled="true">
<collectionProp name="Arguments.arguments"/> <collectionProp name="Arguments.arguments"/>
</elementProp> </elementProp>
<stringProp name="HTTPSampler.domain"></stringProp> <stringProp name="HTTPSampler.domain"></stringProp>
<stringProp name="HTTPSampler.port"></stringProp> <stringProp name="HTTPSampler.port"></stringProp>
<stringProp name="HTTPSampler.connect_timeout"></stringProp> <stringProp name="HTTPSampler.connect_timeout"></stringProp>
<stringProp name="HTTPSampler.response_timeout"></stringProp> <stringProp name="HTTPSampler.response_timeout"></stringProp>
<stringProp name="HTTPSampler.protocol"></stringProp> <stringProp name="HTTPSampler.protocol"></stringProp>
<stringProp name="HTTPSampler.contentEncoding"></stringProp> <stringProp name="HTTPSampler.contentEncoding"></stringProp>
<stringProp name="HTTPSampler.path">${CONTEXT_WEB}/owners.html?lastName=</stringProp> <stringProp name="HTTPSampler.path">${CONTEXT_WEB}/owners.html?lastName=</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp> <stringProp name="HTTPSampler.method">GET</stringProp>
<boolProp name="HTTPSampler.follow_redirects">true</boolProp> <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp> <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp> <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
<boolProp name="HTTPSampler.monitor">false</boolProp> <boolProp name="HTTPSampler.monitor">false</boolProp>
<stringProp name="HTTPSampler.embedded_url_re"></stringProp> <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
</HTTPSamplerProxy> </HTTPSamplerProxy>
<hashTree/> <hashTree/>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Owner" enabled="true"> <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Owner" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="Variables pr<70>-d<>finies" enabled="true"> <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="Variables pr<70>-d<>finies" enabled="true">
<collectionProp name="Arguments.arguments"/> <collectionProp name="Arguments.arguments"/>
</elementProp> </elementProp>
<stringProp name="HTTPSampler.domain"></stringProp> <stringProp name="HTTPSampler.domain"></stringProp>
<stringProp name="HTTPSampler.port"></stringProp> <stringProp name="HTTPSampler.port"></stringProp>
<stringProp name="HTTPSampler.connect_timeout"></stringProp> <stringProp name="HTTPSampler.connect_timeout"></stringProp>
<stringProp name="HTTPSampler.response_timeout"></stringProp> <stringProp name="HTTPSampler.response_timeout"></stringProp>
<stringProp name="HTTPSampler.protocol"></stringProp> <stringProp name="HTTPSampler.protocol"></stringProp>
<stringProp name="HTTPSampler.contentEncoding"></stringProp> <stringProp name="HTTPSampler.contentEncoding"></stringProp>
<stringProp name="HTTPSampler.path">${CONTEXT_WEB}/owners/${count}.html</stringProp> <stringProp name="HTTPSampler.path">${CONTEXT_WEB}/owners/${count}.html</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp> <stringProp name="HTTPSampler.method">GET</stringProp>
<boolProp name="HTTPSampler.follow_redirects">true</boolProp> <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp> <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp> <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
<boolProp name="HTTPSampler.monitor">false</boolProp> <boolProp name="HTTPSampler.monitor">false</boolProp>
<stringProp name="HTTPSampler.embedded_url_re"></stringProp> <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
</HTTPSamplerProxy> </HTTPSamplerProxy>
<hashTree/> <hashTree/>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Edit Owner" enabled="true"> <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Edit Owner" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="Variables pr<70>-d<>finies" enabled="true"> <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="Variables pr<70>-d<>finies" enabled="true">
<collectionProp name="Arguments.arguments"/> <collectionProp name="Arguments.arguments"/>
</elementProp> </elementProp>
<stringProp name="HTTPSampler.domain"></stringProp> <stringProp name="HTTPSampler.domain"></stringProp>
<stringProp name="HTTPSampler.port"></stringProp> <stringProp name="HTTPSampler.port"></stringProp>
<stringProp name="HTTPSampler.connect_timeout"></stringProp> <stringProp name="HTTPSampler.connect_timeout"></stringProp>
<stringProp name="HTTPSampler.response_timeout"></stringProp> <stringProp name="HTTPSampler.response_timeout"></stringProp>
<stringProp name="HTTPSampler.protocol"></stringProp> <stringProp name="HTTPSampler.protocol"></stringProp>
<stringProp name="HTTPSampler.contentEncoding"></stringProp> <stringProp name="HTTPSampler.contentEncoding"></stringProp>
<stringProp name="HTTPSampler.path">${CONTEXT_WEB}/owners/${count}/edit.html</stringProp> <stringProp name="HTTPSampler.path">${CONTEXT_WEB}/owners/${count}/edit.html</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp> <stringProp name="HTTPSampler.method">GET</stringProp>
<boolProp name="HTTPSampler.follow_redirects">true</boolProp> <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp> <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp> <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
<boolProp name="HTTPSampler.monitor">false</boolProp> <boolProp name="HTTPSampler.monitor">false</boolProp>
<stringProp name="HTTPSampler.embedded_url_re"></stringProp> <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
</HTTPSamplerProxy> </HTTPSamplerProxy>
<hashTree/> <hashTree/>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="POST Edit Owner" enabled="true"> <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="POST Edit Owner" enabled="true">
<boolProp name="HTTPSampler.postBodyRaw">true</boolProp> <boolProp name="HTTPSampler.postBodyRaw">true</boolProp>
<elementProp name="HTTPsampler.Arguments" elementType="Arguments"> <elementProp name="HTTPsampler.Arguments" elementType="Arguments">
<collectionProp name="Arguments.arguments"> <collectionProp name="Arguments.arguments">
<elementProp name="" elementType="HTTPArgument"> <elementProp name="" elementType="HTTPArgument">
<boolProp name="HTTPArgument.always_encode">false</boolProp> <boolProp name="HTTPArgument.always_encode">false</boolProp>
<stringProp name="Argument.value">firstName=Test&amp;lastName=${count}&amp;address=1234+Test+St.&amp;city=TestCity&amp;telephone=612345678</stringProp> <stringProp name="Argument.value">firstName=Test&amp;lastName=${count}&amp;address=1234+Test+St.&amp;city=TestCity&amp;telephone=612345678</stringProp>
<stringProp name="Argument.metadata">=</stringProp> <stringProp name="Argument.metadata">=</stringProp>
</elementProp> </elementProp>
</collectionProp> </collectionProp>
</elementProp> </elementProp>
<stringProp name="HTTPSampler.domain"></stringProp> <stringProp name="HTTPSampler.domain"></stringProp>
<stringProp name="HTTPSampler.port"></stringProp> <stringProp name="HTTPSampler.port"></stringProp>
<stringProp name="HTTPSampler.connect_timeout"></stringProp> <stringProp name="HTTPSampler.connect_timeout"></stringProp>
<stringProp name="HTTPSampler.response_timeout"></stringProp> <stringProp name="HTTPSampler.response_timeout"></stringProp>
<stringProp name="HTTPSampler.protocol"></stringProp> <stringProp name="HTTPSampler.protocol"></stringProp>
<stringProp name="HTTPSampler.contentEncoding"></stringProp> <stringProp name="HTTPSampler.contentEncoding"></stringProp>
<stringProp name="HTTPSampler.path">${CONTEXT_WEB}/owners/${count}/edit.html</stringProp> <stringProp name="HTTPSampler.path">${CONTEXT_WEB}/owners/${count}/edit.html</stringProp>
<stringProp name="HTTPSampler.method">POST</stringProp> <stringProp name="HTTPSampler.method">POST</stringProp>
<boolProp name="HTTPSampler.follow_redirects">true</boolProp> <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp> <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp> <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
<boolProp name="HTTPSampler.monitor">false</boolProp> <boolProp name="HTTPSampler.monitor">false</boolProp>
<stringProp name="HTTPSampler.embedded_url_re"></stringProp> <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
</HTTPSamplerProxy> </HTTPSamplerProxy>
<hashTree/> <hashTree/>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="New visit" enabled="true"> <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="New visit" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="Variables pr<70>-d<>finies" enabled="true"> <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="Variables pr<70>-d<>finies" enabled="true">
<collectionProp name="Arguments.arguments"/> <collectionProp name="Arguments.arguments"/>
</elementProp> </elementProp>
<stringProp name="HTTPSampler.domain"></stringProp> <stringProp name="HTTPSampler.domain"></stringProp>
<stringProp name="HTTPSampler.port"></stringProp> <stringProp name="HTTPSampler.port"></stringProp>
<stringProp name="HTTPSampler.connect_timeout"></stringProp> <stringProp name="HTTPSampler.connect_timeout"></stringProp>
<stringProp name="HTTPSampler.response_timeout"></stringProp> <stringProp name="HTTPSampler.response_timeout"></stringProp>
<stringProp name="HTTPSampler.protocol"></stringProp> <stringProp name="HTTPSampler.protocol"></stringProp>
<stringProp name="HTTPSampler.contentEncoding"></stringProp> <stringProp name="HTTPSampler.contentEncoding"></stringProp>
<stringProp name="HTTPSampler.path">${CONTEXT_WEB}/owners/${count}/pets/${petCount}/visits/new</stringProp> <stringProp name="HTTPSampler.path">${CONTEXT_WEB}/owners/${count}/pets/${petCount}/visits/new</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp> <stringProp name="HTTPSampler.method">GET</stringProp>
<boolProp name="HTTPSampler.follow_redirects">true</boolProp> <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp> <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp> <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
<boolProp name="HTTPSampler.monitor">false</boolProp> <boolProp name="HTTPSampler.monitor">false</boolProp>
<stringProp name="HTTPSampler.embedded_url_re"></stringProp> <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
</HTTPSamplerProxy> </HTTPSamplerProxy>
<hashTree/> <hashTree/>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="POST new visit" enabled="true"> <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="POST new visit" enabled="true">
<boolProp name="HTTPSampler.postBodyRaw">true</boolProp> <boolProp name="HTTPSampler.postBodyRaw">true</boolProp>
<elementProp name="HTTPsampler.Arguments" elementType="Arguments"> <elementProp name="HTTPsampler.Arguments" elementType="Arguments">
<collectionProp name="Arguments.arguments"> <collectionProp name="Arguments.arguments">
<elementProp name="" elementType="HTTPArgument"> <elementProp name="" elementType="HTTPArgument">
<boolProp name="HTTPArgument.always_encode">false</boolProp> <boolProp name="HTTPArgument.always_encode">false</boolProp>
<stringProp name="Argument.value">date=2013%2F02%2F22&amp;description=visit</stringProp> <stringProp name="Argument.value">date=2013%2F02%2F22&amp;description=visit</stringProp>
<stringProp name="Argument.metadata">=</stringProp> <stringProp name="Argument.metadata">=</stringProp>
</elementProp> </elementProp>
</collectionProp> </collectionProp>
</elementProp> </elementProp>
<stringProp name="HTTPSampler.domain"></stringProp> <stringProp name="HTTPSampler.domain"></stringProp>
<stringProp name="HTTPSampler.port"></stringProp> <stringProp name="HTTPSampler.port"></stringProp>
<stringProp name="HTTPSampler.connect_timeout"></stringProp> <stringProp name="HTTPSampler.connect_timeout"></stringProp>
<stringProp name="HTTPSampler.response_timeout"></stringProp> <stringProp name="HTTPSampler.response_timeout"></stringProp>
<stringProp name="HTTPSampler.protocol"></stringProp> <stringProp name="HTTPSampler.protocol"></stringProp>
<stringProp name="HTTPSampler.contentEncoding"></stringProp> <stringProp name="HTTPSampler.contentEncoding"></stringProp>
<stringProp name="HTTPSampler.path">${CONTEXT_WEB}/owners/${count}/pets/${petCount}/visits/new</stringProp> <stringProp name="HTTPSampler.path">${CONTEXT_WEB}/owners/${count}/pets/${petCount}/visits/new</stringProp>
<stringProp name="HTTPSampler.method">POST</stringProp> <stringProp name="HTTPSampler.method">POST</stringProp>
<boolProp name="HTTPSampler.follow_redirects">true</boolProp> <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp> <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp> <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
<boolProp name="HTTPSampler.monitor">false</boolProp> <boolProp name="HTTPSampler.monitor">false</boolProp>
<stringProp name="HTTPSampler.embedded_url_re"></stringProp> <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
</HTTPSamplerProxy> </HTTPSamplerProxy>
<hashTree/> <hashTree/>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Owner" enabled="true"> <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Owner" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="Variables pr<70>-d<>finies" enabled="true"> <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="Variables pr<70>-d<>finies" enabled="true">
<collectionProp name="Arguments.arguments"/> <collectionProp name="Arguments.arguments"/>
</elementProp> </elementProp>
<stringProp name="HTTPSampler.domain"></stringProp> <stringProp name="HTTPSampler.domain"></stringProp>
<stringProp name="HTTPSampler.port"></stringProp> <stringProp name="HTTPSampler.port"></stringProp>
<stringProp name="HTTPSampler.connect_timeout"></stringProp> <stringProp name="HTTPSampler.connect_timeout"></stringProp>
<stringProp name="HTTPSampler.response_timeout"></stringProp> <stringProp name="HTTPSampler.response_timeout"></stringProp>
<stringProp name="HTTPSampler.protocol"></stringProp> <stringProp name="HTTPSampler.protocol"></stringProp>
<stringProp name="HTTPSampler.contentEncoding"></stringProp> <stringProp name="HTTPSampler.contentEncoding"></stringProp>
<stringProp name="HTTPSampler.path">${CONTEXT_WEB}/owners/${count}.html</stringProp> <stringProp name="HTTPSampler.path">${CONTEXT_WEB}/owners/${count}.html</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp> <stringProp name="HTTPSampler.method">GET</stringProp>
<boolProp name="HTTPSampler.follow_redirects">true</boolProp> <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp> <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp> <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
<boolProp name="HTTPSampler.monitor">false</boolProp> <boolProp name="HTTPSampler.monitor">false</boolProp>
<stringProp name="HTTPSampler.embedded_url_re"></stringProp> <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
</HTTPSamplerProxy> </HTTPSamplerProxy>
<hashTree/> <hashTree/>
<ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="Results" enabled="false"> <ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="Results" enabled="false">
<boolProp name="ResultCollector.error_logging">false</boolProp> <boolProp name="ResultCollector.error_logging">false</boolProp>
<objProp> <objProp>
<name>saveConfig</name> <name>saveConfig</name>
<value class="SampleSaveConfiguration"> <value class="SampleSaveConfiguration">
<time>true</time> <time>true</time>
<latency>true</latency> <latency>true</latency>
<timestamp>true</timestamp> <timestamp>true</timestamp>
<success>true</success> <success>true</success>
<label>true</label> <label>true</label>
<code>true</code> <code>true</code>
<message>true</message> <message>true</message>
<threadName>true</threadName> <threadName>true</threadName>
<dataType>true</dataType> <dataType>true</dataType>
<encoding>false</encoding> <encoding>false</encoding>
<assertions>true</assertions> <assertions>true</assertions>
<subresults>true</subresults> <subresults>true</subresults>
<responseData>false</responseData> <responseData>false</responseData>
<samplerData>false</samplerData> <samplerData>false</samplerData>
<xml>false</xml> <xml>false</xml>
<fieldNames>false</fieldNames> <fieldNames>false</fieldNames>
<responseHeaders>false</responseHeaders> <responseHeaders>false</responseHeaders>
<requestHeaders>false</requestHeaders> <requestHeaders>false</requestHeaders>
<responseDataOnError>false</responseDataOnError> <responseDataOnError>false</responseDataOnError>
<saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage> <saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
<assertionsResultsToSave>0</assertionsResultsToSave> <assertionsResultsToSave>0</assertionsResultsToSave>
<bytes>true</bytes> <bytes>true</bytes>
<threadCounts>true</threadCounts> <threadCounts>true</threadCounts>
</value> </value>
</objProp> </objProp>
<stringProp name="filename"></stringProp> <stringProp name="filename"></stringProp>
</ResultCollector> </ResultCollector>
<hashTree/> <hashTree/>
<ResultCollector guiclass="StatVisualizer" testclass="ResultCollector" testname="Aggregated report" enabled="true"> <ResultCollector guiclass="StatVisualizer" testclass="ResultCollector" testname="Aggregated report" enabled="true">
<boolProp name="ResultCollector.error_logging">false</boolProp> <boolProp name="ResultCollector.error_logging">false</boolProp>
<objProp> <objProp>
<name>saveConfig</name> <name>saveConfig</name>
<value class="SampleSaveConfiguration"> <value class="SampleSaveConfiguration">
<time>true</time> <time>true</time>
<latency>true</latency> <latency>true</latency>
<timestamp>true</timestamp> <timestamp>true</timestamp>
<success>true</success> <success>true</success>
<label>true</label> <label>true</label>
<code>true</code> <code>true</code>
<message>true</message> <message>true</message>
<threadName>true</threadName> <threadName>true</threadName>
<dataType>true</dataType> <dataType>true</dataType>
<encoding>false</encoding> <encoding>false</encoding>
<assertions>true</assertions> <assertions>true</assertions>
<subresults>true</subresults> <subresults>true</subresults>
<responseData>false</responseData> <responseData>false</responseData>
<samplerData>false</samplerData> <samplerData>false</samplerData>
<xml>false</xml> <xml>false</xml>
<fieldNames>false</fieldNames> <fieldNames>false</fieldNames>
<responseHeaders>false</responseHeaders> <responseHeaders>false</responseHeaders>
<requestHeaders>false</requestHeaders> <requestHeaders>false</requestHeaders>
<responseDataOnError>false</responseDataOnError> <responseDataOnError>false</responseDataOnError>
<saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage> <saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
<assertionsResultsToSave>0</assertionsResultsToSave> <assertionsResultsToSave>0</assertionsResultsToSave>
<bytes>true</bytes> <bytes>true</bytes>
<threadCounts>true</threadCounts> <threadCounts>true</threadCounts>
</value> </value>
</objProp> </objProp>
<stringProp name="filename"></stringProp> <stringProp name="filename"></stringProp>
</ResultCollector> </ResultCollector>
<hashTree/> <hashTree/>
</hashTree> </hashTree>
</hashTree> </hashTree>
</hashTree> </hashTree>
</jmeterTestPlan> </jmeterTestPlan>

View file

@ -1 +1 @@
austin messed up austin messed up

View file

@ -1 +1 @@
./kill.sh && git pull origin dev && ./run.sh & ./kill.sh && git pull origin master && ./run.sh &