Skip to content

Commit

Permalink
Merge branch 'Secure_book_creation_for_role_ADMIN' into Enable_Spring…
Browse files Browse the repository at this point in the history
…_Boot_Actuator
  • Loading branch information
BjoernKW committed Nov 28, 2023
2 parents 5364a9f + 5a0eb0e commit 1eaa428
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.1.4</version>
<version>3.2.0</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>de.workshops</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import org.springframework.stereotype.Repository;

@Repository
public interface BookRepository extends ListCrudRepository<Book, Long> {
interface BookRepository extends ListCrudRepository<Book, Long> {

Book findByIsbn(String isbn);
}
4 changes: 2 additions & 2 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ server:

spring:
datasource:
url: jdbc:postgresql://tai.db.elephantsql.com:5432/tdygxryv # adapt URL to your database
url: jdbc:postgresql://roasted-tomato.db.elephantsql.com:5432/ooqpwbmi # adapt URL to your database
driver-class-name: org.postgresql.Driver
username: tdygxryv # adapt username accordingly
username: ooqpwbmi # adapt username accordingly
# set PG_PASSWORD in your environment, e.g., by running "export PG_PASSWORD=..." in the command line
password: ${PG_PASSWORD}
hikari:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
package de.workshops.bookshelf.book;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;

import java.util.List;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase;
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;

import java.util.List;
import java.util.stream.StreamSupport;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;

@DataJpaTest
@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE)
class BookRepositoryTest {
Expand All @@ -23,9 +21,10 @@ void createBook() {
String isbn = "123-4567890";
Book book = buildAndSaveBook(isbn);

List<Book> books = StreamSupport
.stream(bookRepository.findAll().spliterator(), false)
.toList();
List<Book> books = bookRepository
.findAll()
.stream()
.toList();

assertNotNull(books);
assertEquals(4, books.size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

@TestConfiguration
public class JacksonTestConfiguration {
@Bean
@Bean
public Jackson2ObjectMapperBuilderCustomizer jsonCustomizer() {
return builder -> builder.featuresToEnable(SerializationFeature.INDENT_OUTPUT);
}
Expand Down

0 comments on commit 1eaa428

Please sign in to comment.