diff --git a/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/domain/BaseEntity.java b/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/domain/BaseEntity.java
deleted file mode 100644
index fdc774c16..000000000
--- a/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/domain/BaseEntity.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c): it@M - Dienstleister für Informations- und Telekommunikationstechnik
- * der Landeshauptstadt München, 2024
- */
-package de.muenchen.oss.wahllokalsystem.basisdatenservice.domain;
-
-import static java.sql.Types.VARCHAR;
-
-import jakarta.persistence.Column;
-import jakarta.persistence.GeneratedValue;
-import jakarta.persistence.Id;
-import jakarta.persistence.MappedSuperclass;
-import java.io.Serializable;
-import java.util.UUID;
-import lombok.EqualsAndHashCode;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-import lombok.ToString;
-import org.hibernate.annotations.GenericGenerator;
-import org.hibernate.annotations.JdbcTypeCode;
-
-@MappedSuperclass
-@NoArgsConstructor
-@Getter
-@Setter
-@ToString
-@EqualsAndHashCode
-public abstract class BaseEntity implements Cloneable, Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @Column(name = "id", length = 36)
- @Id
- @GeneratedValue(generator = "uuid")
- @GenericGenerator(name = "uuid", strategy = "uuid2")
- @JdbcTypeCode(VARCHAR)
- private UUID id;
-
-}
diff --git a/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/domain/TheEntity.java b/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/domain/TheEntity.java
deleted file mode 100644
index c8133e8c1..000000000
--- a/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/domain/TheEntity.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c): it@M - Dienstleister für Informations- und Telekommunikationstechnik
- * der Landeshauptstadt München, 2024
- */
-package de.muenchen.oss.wahllokalsystem.basisdatenservice.domain;
-
-import jakarta.persistence.Column;
-import jakarta.persistence.Entity;
-import jakarta.validation.constraints.NotNull;
-import jakarta.validation.constraints.Size;
-import lombok.EqualsAndHashCode;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-import lombok.ToString;
-
-/**
- * This class represents a TheEntity.
- *
- * The entity's content will be loaded according to the reference variable.
- *
- */
-@Entity
-// Definition of getter, setter, ...
-@Getter
-@Setter
-@ToString(callSuper = true)
-@EqualsAndHashCode(callSuper = true)
-@NoArgsConstructor
-public class TheEntity extends BaseEntity {
-
- private static final long serialVersionUID = 1L;
-
- // ========= //
- // Variables //
- // ========= //
-
- @Column(name = "textattribute", nullable = false, length = 8)
- @NotNull
- @Size(min = 2, max = 8)
- private String textAttribute;
-
-}
diff --git a/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/TheEntityRepository.java b/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/TheEntityRepository.java
deleted file mode 100644
index a708e6382..000000000
--- a/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/TheEntityRepository.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright (c): it@M - Dienstleister für Informations- und Telekommunikationstechnik
- * der Landeshauptstadt München, 2024
- */
-package de.muenchen.oss.wahllokalsystem.basisdatenservice.rest;
-
-import de.muenchen.oss.wahllokalsystem.basisdatenservice.domain.TheEntity;
-import java.util.Optional;
-import java.util.UUID;
-import org.springframework.cache.annotation.CacheEvict;
-import org.springframework.cache.annotation.CachePut;
-import org.springframework.cache.annotation.Cacheable;
-import org.springframework.data.repository.CrudRepository;
-import org.springframework.security.access.prepost.PreAuthorize;
-
-/**
- * Provides a Repository for {@link TheEntity}. This Repository is exported as a REST resource.
- *
- * The Repository handles CRUD Operations. Every Operation is secured and takes care of the tenancy.
- * For specific Documentation on how the generated REST point
- * behaves, please consider the Spring Data Rest Reference
- * here.
- *
- */
-@PreAuthorize("hasAuthority(T(de.muenchen.oss.wahllokalsystem.basisdatenservice.security.AuthoritiesEnum).WLS_BASISDATEN_SERVICE_READ_THEENTITY.name())")
-public interface TheEntityRepository extends CrudRepository { //NOSONAR
-
- /**
- * Name for the specific cache.
- */
- String CACHE = "THEENTITY_CACHE";
-
- /**
- * Get one specific {@link TheEntity} by its unique id.
- *
- * @param id The identifier of the {@link TheEntity}.
- * @return The {@link TheEntity} with the requested id.
- */
- @Override
- @Cacheable(value = CACHE, key = "#p0")
- Optional findById(UUID id);
-
- /**
- * Create or update a {@link TheEntity}.
- *
- * If the id already exists, the {@link TheEntity} will be overridden, hence update. If the id does
- * not already exist, a new {@link TheEntity} will be
- * created, hence create.
- *
- *
- * @param theEntity The {@link TheEntity} that will be saved.
- * @return the saved {@link TheEntity}.
- */
- @Override
- @CachePut(value = CACHE, key = "#p0.id")
- @PreAuthorize("hasAuthority(T(de.muenchen.oss.wahllokalsystem.basisdatenservice.security.AuthoritiesEnum).WLS_BASISDATEN_SERVICE_WRITE_THEENTITY.name())")
- S save(S theEntity);
-
- /**
- * Create or update a collection of {@link TheEntity}.
- *
- * If the id already exists, the {@link TheEntity}s will be overridden, hence update. If the id does
- * not already exist, the new {@link TheEntity}s will be
- * created, hence create.
- *
- *
- * @param entities The {@link TheEntity} that will be saved.
- * @return the collection saved {@link TheEntity}.
- */
- @Override
- @PreAuthorize("hasAuthority(T(de.muenchen.oss.wahllokalsystem.basisdatenservice.security.AuthoritiesEnum).WLS_BASISDATEN_SERVICE_WRITE_THEENTITY.name())")
- Iterable saveAll(Iterable entities);
-
- /**
- * Delete the {@link TheEntity} by a specified id.
- *
- * @param id the unique id of the {@link TheEntity} that will be deleted.
- */
- @Override
- @CacheEvict(value = CACHE, key = "#p0")
- @PreAuthorize("hasAuthority(T(de.muenchen.oss.wahllokalsystem.basisdatenservice.security.AuthoritiesEnum).WLS_BASISDATEN_SERVICE_DELETE_THEENTITY.name())")
- void deleteById(UUID id);
-
- /**
- * Delete a {@link TheEntity} by entity.
- *
- * @param entity The {@link TheEntity} that will be deleted.
- */
- @Override
- @CacheEvict(value = CACHE, key = "#p0.id")
- @PreAuthorize("hasAuthority(T(de.muenchen.oss.wahllokalsystem.basisdatenservice.security.AuthoritiesEnum).WLS_BASISDATEN_SERVICE_DELETE_THEENTITY.name())")
- void delete(TheEntity entity);
-
- /**
- * Delete multiple {@link TheEntity} entities by their id.
- *
- * @param entities The Iterable of {@link TheEntity} that will be deleted.
- */
- @Override
- @CacheEvict(value = CACHE, allEntries = true)
- @PreAuthorize("hasAuthority(T(de.muenchen.oss.wahllokalsystem.basisdatenservice.security.AuthoritiesEnum).WLS_BASISDATEN_SERVICE_DELETE_THEENTITY.name())")
- void deleteAll(Iterable extends TheEntity> entities);
-
- /**
- * Delete all {@link TheEntity} entities.
- */
- @Override
- @CacheEvict(value = CACHE, allEntries = true)
- @PreAuthorize("hasAuthority(T(de.muenchen.oss.wahllokalsystem.basisdatenservice.security.AuthoritiesEnum).WLS_BASISDATEN_SERVICE_DELETE_THEENTITY.name())")
- void deleteAll();
-
-}
diff --git a/wls-basisdaten-service/src/main/resources/db/migrations/h2/V9_0__dropTableTheEntity.sql b/wls-basisdaten-service/src/main/resources/db/migrations/h2/V9_0__dropTableTheEntity.sql
new file mode 100644
index 000000000..25bcba5ac
--- /dev/null
+++ b/wls-basisdaten-service/src/main/resources/db/migrations/h2/V9_0__dropTableTheEntity.sql
@@ -0,0 +1 @@
+DROP TABLE theEntity
\ No newline at end of file
diff --git a/wls-basisdaten-service/src/main/resources/db/migrations/oracle/V9_0__dropTableTheEntity.sql b/wls-basisdaten-service/src/main/resources/db/migrations/oracle/V9_0__dropTableTheEntity.sql
new file mode 100644
index 000000000..25bcba5ac
--- /dev/null
+++ b/wls-basisdaten-service/src/main/resources/db/migrations/oracle/V9_0__dropTableTheEntity.sql
@@ -0,0 +1 @@
+DROP TABLE theEntity
\ No newline at end of file
diff --git a/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/configuration/CacheControlConfigurationTest.java b/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/configuration/CacheControlConfigurationTest.java
deleted file mode 100644
index 581326377..000000000
--- a/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/configuration/CacheControlConfigurationTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c): it@M - Dienstleister für Informations- und Telekommunikationstechnik
- * der Landeshauptstadt München, 2024
- */
-package de.muenchen.oss.wahllokalsystem.basisdatenservice.configuration;
-
-import static de.muenchen.oss.wahllokalsystem.basisdatenservice.TestConstants.SPRING_NO_SECURITY_PROFILE;
-import static de.muenchen.oss.wahllokalsystem.basisdatenservice.TestConstants.SPRING_TEST_PROFILE;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-import de.muenchen.oss.wahllokalsystem.basisdatenservice.MicroServiceApplication;
-import org.junit.jupiter.api.Disabled;
-import org.junit.jupiter.api.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.boot.test.web.client.TestRestTemplate;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpMethod;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.test.context.ActiveProfiles;
-
-@SpringBootTest(
- classes = { MicroServiceApplication.class },
- webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
- properties = {
- "spring.datasource.url=jdbc:h2:mem:testexample;DB_CLOSE_ON_EXIT=FALSE",
- "refarch.gracefulshutdown.pre-wait-seconds=0"
- }
-)
-@ActiveProfiles(profiles = { SPRING_TEST_PROFILE, SPRING_NO_SECURITY_PROFILE })
-class CacheControlConfigurationTest {
-
- private static final String ENTITY_ENDPOINT_URL = "/theEntities";
-
- private static final String EXPECTED_CACHE_CONTROL_HEADER_VALUES = "no-cache, no-store, must-revalidate";
-
- @Autowired
- private TestRestTemplate testRestTemplate;
-
- @Test
- @Disabled
- void testForCacheControlHeadersForEntityEndpoint() {
- ResponseEntity response = testRestTemplate.exchange(ENTITY_ENDPOINT_URL, HttpMethod.GET, null, String.class);
- assertEquals(HttpStatus.OK, response.getStatusCode());
- assertTrue(response.getHeaders().containsKey(HttpHeaders.CACHE_CONTROL));
- assertEquals(EXPECTED_CACHE_CONTROL_HEADER_VALUES, response.getHeaders().getCacheControl());
- }
-
-}
diff --git a/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/configuration/UnicodeConfigurationTest.java b/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/configuration/UnicodeConfigurationTest.java
index 46e962965..58a2a9ef8 100644
--- a/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/configuration/UnicodeConfigurationTest.java
+++ b/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/configuration/UnicodeConfigurationTest.java
@@ -6,16 +6,21 @@
import static de.muenchen.oss.wahllokalsystem.basisdatenservice.TestConstants.SPRING_NO_SECURITY_PROFILE;
import static de.muenchen.oss.wahllokalsystem.basisdatenservice.TestConstants.SPRING_TEST_PROFILE;
-import static de.muenchen.oss.wahllokalsystem.basisdatenservice.TestConstants.TheEntityDto;
-import static org.junit.jupiter.api.Assertions.assertEquals;
import de.muenchen.oss.wahllokalsystem.basisdatenservice.MicroServiceApplication;
-import de.muenchen.oss.wahllokalsystem.basisdatenservice.domain.TheEntity;
-import de.muenchen.oss.wahllokalsystem.basisdatenservice.rest.TheEntityRepository;
+import de.muenchen.oss.wahllokalsystem.basisdatenservice.domain.Wahltag;
+import de.muenchen.oss.wahllokalsystem.basisdatenservice.domain.WahltagRepository;
+import de.muenchen.oss.wahllokalsystem.basisdatenservice.domain.wahl.Farbe;
+import de.muenchen.oss.wahllokalsystem.basisdatenservice.domain.wahl.WahlRepository;
+import de.muenchen.oss.wahllokalsystem.basisdatenservice.domain.wahl.Wahlart;
+import de.muenchen.oss.wahllokalsystem.basisdatenservice.rest.wahlen.WahlDTO;
import java.net.URI;
-import java.util.UUID;
-import org.apache.commons.lang3.StringUtils;
-import org.junit.jupiter.api.Disabled;
+import java.time.LocalDate;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import lombok.val;
+import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
@@ -33,7 +38,7 @@
@ActiveProfiles(profiles = { SPRING_TEST_PROFILE, SPRING_NO_SECURITY_PROFILE })
class UnicodeConfigurationTest {
- private static final String ENTITY_ENDPOINT_URL = "/theEntities";
+ private static final String WAHLEN_ENDPOINT_URL = "/businessActions/wahlen/";
/**
* Decomposed string: String "Ä-é" represented with unicode letters "A◌̈-e◌́"
@@ -49,28 +54,36 @@ class UnicodeConfigurationTest {
private TestRestTemplate testRestTemplate;
@Autowired
- private TheEntityRepository theEntityRepository;
+ private WahlRepository wahlRepository;
+
+ @Autowired
+ WahltagRepository wahltagRepository;
@Test
- @Disabled
void testForNfcNormalization() {
- // Persist entity with decomposed string.
- final TheEntityDto theEntityDto = new TheEntityDto();
- theEntityDto.setTextAttribute(TEXT_ATTRIBUTE_DECOMPOSED);
- assertEquals(TEXT_ATTRIBUTE_DECOMPOSED.length(), theEntityDto.getTextAttribute().length());
- final TheEntityDto response = testRestTemplate.postForEntity(URI.create(ENTITY_ENDPOINT_URL), theEntityDto, TheEntityDto.class).getBody();
- // Check whether response contains a composed string.
- assertEquals(TEXT_ATTRIBUTE_COMPOSED, response.getTextAttribute());
- assertEquals(TEXT_ATTRIBUTE_COMPOSED.length(), response.getTextAttribute().length());
+ // Persist entity with decomposed string
+ // wahltag required for next step to store a list of wahlen
+ var searchingForWahltag = new Wahltag("wahltagID", LocalDate.now(), "beschreibung5", "1");
+ wahltagRepository.save(searchingForWahltag);
+ // create a list of Wahl with only one Wahl containing the TEXT_ATTRIBUTE_DECOMPOSED as 'name'
+ val wahlDTOList = createControllerListOfWahlDTO(searchingForWahltag);
+ Assertions.assertThat(wahlDTOList.get(0).name()).hasSize(TEXT_ATTRIBUTE_DECOMPOSED.length());
+ // store list of Wahl
+ testRestTemplate.postForEntity(URI.create(WAHLEN_ENDPOINT_URL + searchingForWahltag.getWahltagID()), wahlDTOList, Void.class);
+
+ // Get the one and only Wahl from repo which now should contain a composed string in the 'name' attribute
+ val wahl = wahlRepository.findById("wahlID1").orElseThrow();
+ Assertions.assertThat(TEXT_ATTRIBUTE_COMPOSED).isEqualTo(wahl.getName());
+ Assertions.assertThat(wahl.getName()).hasSize(TEXT_ATTRIBUTE_COMPOSED.length());
+ }
- // Extract uuid from self link.
- final UUID uuid = UUID.fromString(StringUtils.substringAfterLast(response.getRequiredLink("self").getHref(), "/"));
+ private List createControllerListOfWahlDTO(Wahltag searchingForWahltag) {
+ val wahl1 = new de.muenchen.oss.wahllokalsystem.basisdatenservice.rest.wahlen.WahlDTO("wahlID1", TEXT_ATTRIBUTE_DECOMPOSED, 3L, 1L,
+ searchingForWahltag.getWahltag(),
+ Wahlart.BAW, new Farbe(1, 1, 1), "1");
- // Check persisted entity contains a composed string via JPA repository.
- final TheEntity theEntity = theEntityRepository.findById(uuid).orElse(null);
- assertEquals(TEXT_ATTRIBUTE_COMPOSED, theEntity.getTextAttribute());
- assertEquals(TEXT_ATTRIBUTE_COMPOSED.length(), theEntity.getTextAttribute().length());
+ return Stream.of(wahl1).filter(wahl -> (wahl.wahltag().equals(searchingForWahltag.getWahltag()))).collect(Collectors.toList());
}
}
diff --git a/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/TheEntityRepositoryTest.java b/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/TheEntityRepositoryTest.java
deleted file mode 100644
index e1104b2c1..000000000
--- a/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/TheEntityRepositoryTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (c): it@M - Dienstleister für Informations- und Telekommunikationstechnik
- * der Landeshauptstadt München, 2024
- */
-package de.muenchen.oss.wahllokalsystem.basisdatenservice.rest;
-
-import static de.muenchen.oss.wahllokalsystem.basisdatenservice.TestConstants.SPRING_NO_SECURITY_PROFILE;
-import static de.muenchen.oss.wahllokalsystem.basisdatenservice.TestConstants.SPRING_TEST_PROFILE;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-
-import de.muenchen.oss.wahllokalsystem.basisdatenservice.MicroServiceApplication;
-import de.muenchen.oss.wahllokalsystem.basisdatenservice.domain.TheEntity;
-import org.junit.jupiter.api.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.ActiveProfiles;
-import org.springframework.transaction.annotation.Propagation;
-import org.springframework.transaction.annotation.Transactional;
-
-@SpringBootTest(
- classes = { MicroServiceApplication.class },
- webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
- properties = {
- "spring.datasource.url=jdbc:h2:mem:wls;DB_CLOSE_ON_EXIT=FALSE",
- "refarch.gracefulshutdown.pre-wait-seconds=0"
- }
-)
-@ActiveProfiles(profiles = { SPRING_TEST_PROFILE, SPRING_NO_SECURITY_PROFILE })
-class TheEntityRepositoryTest {
-
- @Autowired
- private TheEntityRepository repository;
-
- @Test
- @Transactional(propagation = Propagation.REQUIRED, noRollbackFor = Exception.class)
- void testSave() {
-
- // Implement your logic here by replacing and/or extending the code
-
- // initialize
- TheEntity original = new TheEntity();
- original.setTextAttribute("test");
-
- // persist
- original = repository.save(original);
-
- // check
- TheEntity persisted = repository.findById(original.getId()).orElse(null);
- assertNotNull(persisted);
- assertEquals(original, persisted);
-
- }
-
-}
diff --git a/wls-infomanagement-service/src/main/java/de/muenchen/oss/wahllokalsystem/infomanagementservice/domain/BaseEntity.java b/wls-infomanagement-service/src/main/java/de/muenchen/oss/wahllokalsystem/infomanagementservice/domain/BaseEntity.java
deleted file mode 100644
index 3b4fc04a8..000000000
--- a/wls-infomanagement-service/src/main/java/de/muenchen/oss/wahllokalsystem/infomanagementservice/domain/BaseEntity.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c): it@M - Dienstleister für Informations- und Telekommunikationstechnik
- * der Landeshauptstadt München, 2024
- */
-package de.muenchen.oss.wahllokalsystem.infomanagementservice.domain;
-
-import static java.sql.Types.VARCHAR;
-
-import jakarta.persistence.Column;
-import jakarta.persistence.GeneratedValue;
-import jakarta.persistence.Id;
-import jakarta.persistence.MappedSuperclass;
-import java.io.Serializable;
-import java.util.UUID;
-import lombok.EqualsAndHashCode;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-import lombok.ToString;
-import org.hibernate.annotations.GenericGenerator;
-import org.hibernate.annotations.JdbcTypeCode;
-
-@MappedSuperclass
-@NoArgsConstructor
-@Getter
-@Setter
-@ToString
-@EqualsAndHashCode
-public abstract class BaseEntity implements Cloneable, Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @Column(name = "id", length = 36)
- @Id
- @GeneratedValue(generator = "uuid")
- @GenericGenerator(name = "uuid", strategy = "uuid2")
- @JdbcTypeCode(VARCHAR)
- private UUID id;
-
-}
diff --git a/wls-infomanagement-service/src/main/java/de/muenchen/oss/wahllokalsystem/infomanagementservice/domain/TheEntity.java b/wls-infomanagement-service/src/main/java/de/muenchen/oss/wahllokalsystem/infomanagementservice/domain/TheEntity.java
deleted file mode 100644
index 9bc91b7d3..000000000
--- a/wls-infomanagement-service/src/main/java/de/muenchen/oss/wahllokalsystem/infomanagementservice/domain/TheEntity.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c): it@M - Dienstleister für Informations- und Telekommunikationstechnik
- * der Landeshauptstadt München, 2024
- */
-package de.muenchen.oss.wahllokalsystem.infomanagementservice.domain;
-
-import jakarta.persistence.Column;
-import jakarta.persistence.Entity;
-import jakarta.validation.constraints.NotNull;
-import jakarta.validation.constraints.Size;
-import lombok.EqualsAndHashCode;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-import lombok.ToString;
-
-/**
- * This class represents a TheEntity.
- *
- * The entity's content will be loaded according to the reference variable.
- *
- */
-@Entity
-// Definition of getter, setter, ...
-@Getter
-@Setter
-@ToString(callSuper = true)
-@EqualsAndHashCode(callSuper = true)
-@NoArgsConstructor
-public class TheEntity extends BaseEntity {
-
- private static final long serialVersionUID = 1L;
-
- // ========= //
- // Variables //
- // ========= //
-
- @Column(name = "textattribute", nullable = false, length = 8)
- @NotNull
- @Size(min = 2, max = 8)
- private String textAttribute;
-
-}
diff --git a/wls-infomanagement-service/src/main/java/de/muenchen/oss/wahllokalsystem/infomanagementservice/rest/TheEntityRepository.java b/wls-infomanagement-service/src/main/java/de/muenchen/oss/wahllokalsystem/infomanagementservice/rest/TheEntityRepository.java
deleted file mode 100644
index 971ae4e59..000000000
--- a/wls-infomanagement-service/src/main/java/de/muenchen/oss/wahllokalsystem/infomanagementservice/rest/TheEntityRepository.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright (c): it@M - Dienstleister für Informations- und Telekommunikationstechnik
- * der Landeshauptstadt München, 2024
- */
-package de.muenchen.oss.wahllokalsystem.infomanagementservice.rest;
-
-import de.muenchen.oss.wahllokalsystem.infomanagementservice.domain.TheEntity;
-import java.util.Optional;
-import java.util.UUID;
-import org.springframework.cache.annotation.CacheEvict;
-import org.springframework.cache.annotation.CachePut;
-import org.springframework.cache.annotation.Cacheable;
-import org.springframework.data.repository.CrudRepository;
-import org.springframework.security.access.prepost.PreAuthorize;
-
-/**
- * Provides a Repository for {@link TheEntity}. This Repository is exported as a REST resource.
- *
- * The Repository handles CRUD Operations. Every Operation is secured and takes care of the tenancy.
- * For specific Documentation on how the generated REST point behaves, please consider the Spring
- * Data Rest Reference
- * here.
- *
- */
-@PreAuthorize(
- "hasAuthority(T(de.muenchen.oss.wahllokalsystem.infomanagementservice.security.AuthoritiesEnum).WLS_INFOMANAGEMENT_SERVICE_READ_THEENTITY.name())"
-)
-public interface TheEntityRepository extends CrudRepository { //NOSONAR
-
- /**
- * Name for the specific cache.
- */
- String CACHE = "THEENTITY_CACHE";
-
- /**
- * Get one specific {@link TheEntity} by its unique id.
- *
- * @param id The identifier of the {@link TheEntity}.
- * @return The {@link TheEntity} with the requested id.
- */
- @Override
- @Cacheable(value = CACHE, key = "#p0")
- Optional findById(UUID id);
-
- /**
- * Create or update a {@link TheEntity}.
- *
- * If the id already exists, the {@link TheEntity} will be overridden, hence update.
- * If the id does not already exist, a new {@link TheEntity} will be created, hence create.
- *
- *
- * @param theEntity The {@link TheEntity} that will be saved.
- * @return the saved {@link TheEntity}.
- */
- @Override
- @CachePut(value = CACHE, key = "#p0.id")
- @PreAuthorize(
- "hasAuthority(T(de.muenchen.oss.wahllokalsystem.infomanagementservice.security.AuthoritiesEnum).WLS_INFOMANAGEMENT_SERVICE_WRITE_THEENTITY.name())"
- )
- S save(S theEntity);
-
- /**
- * Create or update a collection of {@link TheEntity}.
- *
- * If the id already exists, the {@link TheEntity}s will be overridden, hence update.
- * If the id does not already exist, the new {@link TheEntity}s will be created, hence create.
- *
- *
- * @param entities The {@link TheEntity} that will be saved.
- * @return the collection saved {@link TheEntity}.
- */
- @Override
- @PreAuthorize(
- "hasAuthority(T(de.muenchen.oss.wahllokalsystem.infomanagementservice.security.AuthoritiesEnum).WLS_INFOMANAGEMENT_SERVICE_WRITE_THEENTITY.name())"
- )
- Iterable saveAll(Iterable entities);
-
- /**
- * Delete the {@link TheEntity} by a specified id.
- *
- * @param id the unique id of the {@link TheEntity} that will be deleted.
- */
- @Override
- @CacheEvict(value = CACHE, key = "#p0")
- @PreAuthorize(
- "hasAuthority(T(de.muenchen.oss.wahllokalsystem.infomanagementservice.security.AuthoritiesEnum).WLS_INFOMANAGEMENT_SERVICE_DELETE_THEENTITY.name())"
- )
- void deleteById(UUID id);
-
- /**
- * Delete a {@link TheEntity} by entity.
- *
- * @param entity The {@link TheEntity} that will be deleted.
- */
- @Override
- @CacheEvict(value = CACHE, key = "#p0.id")
- @PreAuthorize(
- "hasAuthority(T(de.muenchen.oss.wahllokalsystem.infomanagementservice.security.AuthoritiesEnum).WLS_INFOMANAGEMENT_SERVICE_DELETE_THEENTITY.name())"
- )
- void delete(TheEntity entity);
-
- /**
- * Delete multiple {@link TheEntity} entities by their id.
- *
- * @param entities The Iterable of {@link TheEntity} that will be deleted.
- */
- @Override
- @CacheEvict(value = CACHE, allEntries = true)
- @PreAuthorize(
- "hasAuthority(T(de.muenchen.oss.wahllokalsystem.infomanagementservice.security.AuthoritiesEnum).WLS_INFOMANAGEMENT_SERVICE_DELETE_THEENTITY.name())"
- )
- void deleteAll(Iterable extends TheEntity> entities);
-
- /**
- * Delete all {@link TheEntity} entities.
- */
- @Override
- @CacheEvict(value = CACHE, allEntries = true)
- @PreAuthorize(
- "hasAuthority(T(de.muenchen.oss.wahllokalsystem.infomanagementservice.security.AuthoritiesEnum).WLS_INFOMANAGEMENT_SERVICE_DELETE_THEENTITY.name())"
- )
- void deleteAll();
-
-}
diff --git a/wls-infomanagement-service/src/main/resources/db/migrations/h2/V3_0__dropTableTheEntity.sql b/wls-infomanagement-service/src/main/resources/db/migrations/h2/V3_0__dropTableTheEntity.sql
new file mode 100644
index 000000000..509a5dceb
--- /dev/null
+++ b/wls-infomanagement-service/src/main/resources/db/migrations/h2/V3_0__dropTableTheEntity.sql
@@ -0,0 +1 @@
+DROP TABLE theEntity;
\ No newline at end of file
diff --git a/wls-infomanagement-service/src/main/resources/db/migrations/oracle/V3_0__dropTableTheEntity.sql b/wls-infomanagement-service/src/main/resources/db/migrations/oracle/V3_0__dropTableTheEntity.sql
new file mode 100644
index 000000000..509a5dceb
--- /dev/null
+++ b/wls-infomanagement-service/src/main/resources/db/migrations/oracle/V3_0__dropTableTheEntity.sql
@@ -0,0 +1 @@
+DROP TABLE theEntity;
\ No newline at end of file
diff --git a/wls-infomanagement-service/src/test/java/de/muenchen/oss/wahllokalsystem/infomanagementservice/configuration/CacheControlConfigurationTest.java b/wls-infomanagement-service/src/test/java/de/muenchen/oss/wahllokalsystem/infomanagementservice/configuration/CacheControlConfigurationTest.java
deleted file mode 100644
index 16c8c7a11..000000000
--- a/wls-infomanagement-service/src/test/java/de/muenchen/oss/wahllokalsystem/infomanagementservice/configuration/CacheControlConfigurationTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c): it@M - Dienstleister für Informations- und Telekommunikationstechnik
- * der Landeshauptstadt München, 2024
- */
-package de.muenchen.oss.wahllokalsystem.infomanagementservice.configuration;
-
-import static de.muenchen.oss.wahllokalsystem.infomanagementservice.TestConstants.SPRING_NO_SECURITY_PROFILE;
-import static de.muenchen.oss.wahllokalsystem.infomanagementservice.TestConstants.SPRING_TEST_PROFILE;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-import de.muenchen.oss.wahllokalsystem.infomanagementservice.MicroServiceApplication;
-import org.junit.jupiter.api.Disabled;
-import org.junit.jupiter.api.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.boot.test.web.client.TestRestTemplate;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpMethod;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.test.context.ActiveProfiles;
-
-@SpringBootTest(
- classes = { MicroServiceApplication.class },
- webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
- properties = {
- "spring.datasource.url=jdbc:h2:mem:testexample;DB_CLOSE_ON_EXIT=FALSE",
- "refarch.gracefulshutdown.pre-wait-seconds=0"
- }
-)
-@ActiveProfiles(profiles = { SPRING_TEST_PROFILE, SPRING_NO_SECURITY_PROFILE })
-class CacheControlConfigurationTest {
-
- private static final String ENTITY_ENDPOINT_URL = "/theEntities";
-
- private static final String EXPECTED_CACHE_CONTROL_HEADER_VALUES = "no-cache, no-store, must-revalidate";
-
- @Autowired
- private TestRestTemplate testRestTemplate;
-
- @Test
- @Disabled
- void testForCacheControlHeadersForEntityEndpoint() {
- ResponseEntity response = testRestTemplate.exchange(ENTITY_ENDPOINT_URL, HttpMethod.GET, null, String.class);
- assertEquals(HttpStatus.OK, response.getStatusCode());
- assertTrue(response.getHeaders().containsKey(HttpHeaders.CACHE_CONTROL));
- assertEquals(EXPECTED_CACHE_CONTROL_HEADER_VALUES, response.getHeaders().getCacheControl());
- }
-
-}
diff --git a/wls-infomanagement-service/src/test/java/de/muenchen/oss/wahllokalsystem/infomanagementservice/configuration/UnicodeConfigurationTest.java b/wls-infomanagement-service/src/test/java/de/muenchen/oss/wahllokalsystem/infomanagementservice/configuration/UnicodeConfigurationTest.java
index b04fc9ef6..f4baa651e 100644
--- a/wls-infomanagement-service/src/test/java/de/muenchen/oss/wahllokalsystem/infomanagementservice/configuration/UnicodeConfigurationTest.java
+++ b/wls-infomanagement-service/src/test/java/de/muenchen/oss/wahllokalsystem/infomanagementservice/configuration/UnicodeConfigurationTest.java
@@ -6,16 +6,15 @@
import static de.muenchen.oss.wahllokalsystem.infomanagementservice.TestConstants.SPRING_NO_SECURITY_PROFILE;
import static de.muenchen.oss.wahllokalsystem.infomanagementservice.TestConstants.SPRING_TEST_PROFILE;
-import static de.muenchen.oss.wahllokalsystem.infomanagementservice.TestConstants.TheEntityDto;
-import static org.junit.jupiter.api.Assertions.assertEquals;
import de.muenchen.oss.wahllokalsystem.infomanagementservice.MicroServiceApplication;
-import de.muenchen.oss.wahllokalsystem.infomanagementservice.domain.TheEntity;
-import de.muenchen.oss.wahllokalsystem.infomanagementservice.rest.TheEntityRepository;
+
import java.net.URI;
-import java.util.UUID;
-import org.apache.commons.lang3.StringUtils;
-import org.junit.jupiter.api.Disabled;
+
+import de.muenchen.oss.wahllokalsystem.infomanagementservice.domain.konfiguration.KonfigurationRepository;
+import de.muenchen.oss.wahllokalsystem.infomanagementservice.rest.konfiguration.dto.KonfigurationDTO;
+import lombok.val;
+import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
@@ -33,7 +32,7 @@
@ActiveProfiles(profiles = { SPRING_TEST_PROFILE, SPRING_NO_SECURITY_PROFILE })
class UnicodeConfigurationTest {
- private static final String ENTITY_ENDPOINT_URL = "/theEntities";
+ private static final String ENTITY_ENDPOINT_URL = "/businessActions/konfiguration/WILLKOMMENSTEXT";
/**
* Decomposed string:
@@ -51,28 +50,17 @@ class UnicodeConfigurationTest {
private TestRestTemplate testRestTemplate;
@Autowired
- private TheEntityRepository theEntityRepository;
+ private KonfigurationRepository konfigurationRepository;
@Test
- @Disabled
void testForNfcNormalization() {
- // Persist entity with decomposed string.
- final TheEntityDto theEntityDto = new TheEntityDto();
- theEntityDto.setTextAttribute(TEXT_ATTRIBUTE_DECOMPOSED);
- assertEquals(TEXT_ATTRIBUTE_DECOMPOSED.length(), theEntityDto.getTextAttribute().length());
- final TheEntityDto response = testRestTemplate.postForEntity(URI.create(ENTITY_ENDPOINT_URL), theEntityDto, TheEntityDto.class).getBody();
-
- // Check whether response contains a composed string.
- assertEquals(TEXT_ATTRIBUTE_COMPOSED, response.getTextAttribute());
- assertEquals(TEXT_ATTRIBUTE_COMPOSED.length(), response.getTextAttribute().length());
-
- // Extract uuid from self link.
- final UUID uuid = UUID.fromString(StringUtils.substringAfterLast(response.getRequiredLink("self").getHref(), "/"));
+ val konfigurationDTO = KonfigurationDTO.builder().schluessel("WILLKOMMENSTEXT").beschreibung(TEXT_ATTRIBUTE_DECOMPOSED).build();
+ Assertions.assertThat(konfigurationDTO.beschreibung()).hasSize(TEXT_ATTRIBUTE_DECOMPOSED.length());
+ testRestTemplate.postForEntity(URI.create(ENTITY_ENDPOINT_URL), konfigurationDTO, Void.class);
// Check persisted entity contains a composed string via JPA repository.
- final TheEntity theEntity = theEntityRepository.findById(uuid).orElse(null);
- assertEquals(TEXT_ATTRIBUTE_COMPOSED, theEntity.getTextAttribute());
- assertEquals(TEXT_ATTRIBUTE_COMPOSED.length(), theEntity.getTextAttribute().length());
+ val konfiguration = konfigurationRepository.findById("WILLKOMMENSTEXT").orElseThrow();
+ Assertions.assertThat(konfiguration.getBeschreibung()).isEqualTo(TEXT_ATTRIBUTE_COMPOSED);
+ Assertions.assertThat(konfiguration.getBeschreibung()).hasSize(TEXT_ATTRIBUTE_COMPOSED.length());
}
-
}
diff --git a/wls-infomanagement-service/src/test/java/de/muenchen/oss/wahllokalsystem/infomanagementservice/rest/TheEntityRepositoryTest.java b/wls-infomanagement-service/src/test/java/de/muenchen/oss/wahllokalsystem/infomanagementservice/rest/TheEntityRepositoryTest.java
deleted file mode 100644
index d35d8f902..000000000
--- a/wls-infomanagement-service/src/test/java/de/muenchen/oss/wahllokalsystem/infomanagementservice/rest/TheEntityRepositoryTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (c): it@M - Dienstleister für Informations- und Telekommunikationstechnik
- * der Landeshauptstadt München, 2024
- */
-package de.muenchen.oss.wahllokalsystem.infomanagementservice.rest;
-
-import static de.muenchen.oss.wahllokalsystem.infomanagementservice.TestConstants.SPRING_NO_SECURITY_PROFILE;
-import static de.muenchen.oss.wahllokalsystem.infomanagementservice.TestConstants.SPRING_TEST_PROFILE;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-
-import de.muenchen.oss.wahllokalsystem.infomanagementservice.MicroServiceApplication;
-import de.muenchen.oss.wahllokalsystem.infomanagementservice.domain.TheEntity;
-import org.junit.jupiter.api.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.ActiveProfiles;
-import org.springframework.transaction.annotation.Propagation;
-import org.springframework.transaction.annotation.Transactional;
-
-@SpringBootTest(
- classes = { MicroServiceApplication.class },
- webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
- properties = {
- "spring.datasource.url=jdbc:h2:mem:wls;DB_CLOSE_ON_EXIT=FALSE",
- "refarch.gracefulshutdown.pre-wait-seconds=0"
- }
-)
-@ActiveProfiles(profiles = { SPRING_TEST_PROFILE, SPRING_NO_SECURITY_PROFILE })
-class TheEntityRepositoryTest {
-
- @Autowired
- private TheEntityRepository repository;
-
- @Test
- @Transactional(propagation = Propagation.REQUIRED, noRollbackFor = Exception.class)
- void testSave() {
-
- // Implement your logic here by replacing and/or extending the code
-
- // initialize
- TheEntity original = new TheEntity();
- original.setTextAttribute("test");
-
- // persist
- original = repository.save(original);
-
- // check
- TheEntity persisted = repository.findById(original.getId()).orElse(null);
- assertNotNull(persisted);
- assertEquals(original, persisted);
-
- }
-
-}