Compare commits

...

7 commits

Author SHA1 Message Date
Jesse Houldsworth
78ba4ec99d
Merge 776faecee4 into 332abbcb8a 2025-04-07 19:35:09 +00:00
Jesse Houldsworth
776faecee4 fixing frogbot repositories config 2025-04-07 12:34:50 -07:00
Jesse Houldsworth
169eee925e fixing frogbot 2025-04-07 12:33:30 -07:00
Dave Syer
332abbcb8a Note about windows shell
Some checks failed
Java CI with Gradle / build (17) (push) Failing after 1s
Java CI with Maven / build (17) (push) Failing after 1s
2025-03-27 16:10:48 +00:00
Antoine Rey
d7cc02f3d7 Use the java.util List.of() instead of the AssetJ Lists class
Some checks failed
Java CI with Gradle / build (17) (push) Failing after 2s
Java CI with Maven / build (17) (push) Failing after 2s
Signed-off-by: Antoine Rey <antoine.rey@free.fr>
2025-03-26 08:52:01 +00:00
Antoine Rey
fceca7754a Associating a <label> with a form control
Signed-off-by: Antoine Rey <antoine.rey@free.fr>
2025-03-26 08:51:24 +00:00
Antoine Rey
7f1af268ec Remove unnecessary @Autowired annotation from the PetTypeFormatter
Signed-off-by: Antoine Rey <antoine.rey@free.fr>
2025-03-26 08:51:00 +00:00
8 changed files with 17 additions and 17 deletions

View file

@ -22,15 +22,15 @@ jobs:
# [Mandatory if JF_USER and JF_PASSWORD are not provided] # [Mandatory if JF_USER and JF_PASSWORD are not provided]
# JFrog access token with 'read' permissions on Xray service # JFrog access token with 'read' permissions on Xray service
JF_ACCESS_TOKEN: ${{ secrets.JF_ACCESS_TOKEN }} # JF_ACCESS_TOKEN: ${{ secrets.JF_ACCESS_TOKEN }}
# [Mandatory if JF_ACCESS_TOKEN is not provided] # [Mandatory if JF_ACCESS_TOKEN is not provided]
# JFrog username with 'read' permissions for Xray. Must be provided with JF_PASSWORD # JFrog username with 'read' permissions for Xray. Must be provided with JF_PASSWORD
# JF_USER: ${{ secrets.JF_USER }} JF_USER: ${{ secrets.JF_USER }}
# [Mandatory if JF_ACCESS_TOKEN is not provided] # [Mandatory if JF_ACCESS_TOKEN is not provided]
# JFrog password. Must be provided with JF_USER # JFrog password. Must be provided with JF_USER
# JF_PASSWORD: ${{ secrets.JF_PASSWORD }} JF_PASSWORD: ${{ secrets.JF_ACCESS_TOKEN }}
# [Mandatory] # [Mandatory]
# The GitHub token is automatically generated for the job # The GitHub token is automatically generated for the job

View file

@ -30,11 +30,11 @@ jobs:
# [Mandatory if JF_ACCESS_TOKEN is not provided] # [Mandatory if JF_ACCESS_TOKEN is not provided]
# JFrog username with 'read' permissions for Xray. Must be provided with JF_PASSWORD # JFrog username with 'read' permissions for Xray. Must be provided with JF_PASSWORD
# JF_USER: ${{ secrets.JF_USER }} JF_USER: ${{ secrets.JF_USER }}
# [Mandatory if JF_ACCESS_TOKEN is not provided] # [Mandatory if JF_ACCESS_TOKEN is not provided]
# JFrog password. Must be provided with JF_USER # JFrog password. Must be provided with JF_USER
# JF_PASSWORD: ${{ secrets.JF_PASSWORD }} JF_PASSWORD: ${{ secrets.JF_ACCESS_TOKEN }}
# [Mandatory] # [Mandatory]
# The GitHub token is automatically generated for the job # The GitHub token is automatically generated for the job

View file

@ -17,6 +17,8 @@ cd spring-petclinic
java -jar target/*.jar java -jar target/*.jar
``` ```
(On Windows, or if your shell doesn't expand the glob, you might need to specify the JAR file name explicitly on the command line at the end there.)
You can then access the Petclinic at <http://localhost:8080/>. You can then access the Petclinic at <http://localhost:8080/>.
<img width="1042" alt="petclinic-screenshot" src="https://cloud.githubusercontent.com/assets/838318/19727082/2aee6d6c-9b8e-11e6-81fe-e889a5ddfded.png"> <img width="1042" alt="petclinic-screenshot" src="https://cloud.githubusercontent.com/assets/838318/19727082/2aee6d6c-9b8e-11e6-81fe-e889a5ddfded.png">

View file

@ -15,7 +15,6 @@
*/ */
package org.springframework.samples.petclinic.owner; package org.springframework.samples.petclinic.owner;
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;
@ -38,7 +37,6 @@ public class PetTypeFormatter implements Formatter<PetType> {
private final OwnerRepository owners; private final OwnerRepository owners;
@Autowired
public PetTypeFormatter(OwnerRepository owners) { public PetTypeFormatter(OwnerRepository owners) {
this.owners = owners; this.owners = owners;
} }

View file

@ -5,7 +5,7 @@
<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 th:for="${name}" class="col-sm-2 control-label" th:text="${label}">Label</label>
<div class="col-sm-10"> <div class="col-sm-10">
<div th:switch="${type}"> <div th:switch="${type}">
<input th:case="'text'" class="form-control" type="text" th:field="*{__${name}__}" /> <input th:case="'text'" class="form-control" type="text" th:field="*{__${name}__}" />

View file

@ -5,7 +5,7 @@
<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 th:for="${name}" 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}__}">

View file

@ -16,7 +16,6 @@
package org.springframework.samples.petclinic.owner; package org.springframework.samples.petclinic.owner;
import org.assertj.core.util.Lists;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledInNativeImage; import org.junit.jupiter.api.condition.DisabledInNativeImage;
@ -31,6 +30,7 @@ import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.List;
import java.util.Optional; import java.util.Optional;
import static org.hamcrest.Matchers.empty; import static org.hamcrest.Matchers.empty;
@ -92,9 +92,9 @@ class OwnerControllerTests {
Owner george = george(); Owner george = george();
given(this.owners.findByLastNameStartingWith(eq("Franklin"), any(Pageable.class))) given(this.owners.findByLastNameStartingWith(eq("Franklin"), any(Pageable.class)))
.willReturn(new PageImpl<>(Lists.newArrayList(george))); .willReturn(new PageImpl<>(List.of(george)));
given(this.owners.findAll(any(Pageable.class))).willReturn(new PageImpl<>(Lists.newArrayList(george))); given(this.owners.findAll(any(Pageable.class))).willReturn(new PageImpl<>(List.of(george)));
given(this.owners.findById(TEST_OWNER_ID)).willReturn(Optional.of(george)); given(this.owners.findById(TEST_OWNER_ID)).willReturn(Optional.of(george));
Visit visit = new Visit(); Visit visit = new Visit();
@ -143,14 +143,14 @@ class OwnerControllerTests {
@Test @Test
void testProcessFindFormSuccess() throws Exception { void testProcessFindFormSuccess() throws Exception {
Page<Owner> tasks = new PageImpl<>(Lists.newArrayList(george(), new Owner())); Page<Owner> tasks = new PageImpl<>(List.of(george(), new Owner()));
when(this.owners.findByLastNameStartingWith(anyString(), any(Pageable.class))).thenReturn(tasks); when(this.owners.findByLastNameStartingWith(anyString(), any(Pageable.class))).thenReturn(tasks);
mockMvc.perform(get("/owners?page=1")).andExpect(status().isOk()).andExpect(view().name("owners/ownersList")); mockMvc.perform(get("/owners?page=1")).andExpect(status().isOk()).andExpect(view().name("owners/ownersList"));
} }
@Test @Test
void testProcessFindFormByLastName() throws Exception { void testProcessFindFormByLastName() throws Exception {
Page<Owner> tasks = new PageImpl<>(Lists.newArrayList(george())); Page<Owner> tasks = new PageImpl<>(List.of(george()));
when(this.owners.findByLastNameStartingWith(eq("Franklin"), any(Pageable.class))).thenReturn(tasks); when(this.owners.findByLastNameStartingWith(eq("Franklin"), any(Pageable.class))).thenReturn(tasks);
mockMvc.perform(get("/owners?page=1").param("lastName", "Franklin")) mockMvc.perform(get("/owners?page=1").param("lastName", "Franklin"))
.andExpect(status().is3xxRedirection()) .andExpect(status().is3xxRedirection())
@ -159,7 +159,7 @@ class OwnerControllerTests {
@Test @Test
void testProcessFindFormNoOwnersFound() throws Exception { void testProcessFindFormNoOwnersFound() throws Exception {
Page<Owner> tasks = new PageImpl<>(Lists.newArrayList()); Page<Owner> tasks = new PageImpl<>(List.of());
when(this.owners.findByLastNameStartingWith(eq("Unknown Surname"), any(Pageable.class))).thenReturn(tasks); when(this.owners.findByLastNameStartingWith(eq("Unknown Surname"), any(Pageable.class))).thenReturn(tasks);
mockMvc.perform(get("/owners?page=1").param("lastName", "Unknown Surname")) mockMvc.perform(get("/owners?page=1").param("lastName", "Unknown Surname"))
.andExpect(status().isOk()) .andExpect(status().isOk())

View file

@ -16,7 +16,6 @@
package org.springframework.samples.petclinic.owner; package org.springframework.samples.petclinic.owner;
import org.assertj.core.util.Lists;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
@ -30,6 +29,7 @@ import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MockMvc;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.List;
import java.util.Optional; import java.util.Optional;
import static org.mockito.BDDMockito.given; import static org.mockito.BDDMockito.given;
@ -66,7 +66,7 @@ class PetControllerTests {
PetType cat = new PetType(); PetType cat = new PetType();
cat.setId(3); cat.setId(3);
cat.setName("hamster"); cat.setName("hamster");
given(this.owners.findPetTypes()).willReturn(Lists.newArrayList(cat)); given(this.owners.findPetTypes()).willReturn(List.of(cat));
Owner owner = new Owner(); Owner owner = new Owner();
Pet pet = new Pet(); Pet pet = new Pet();