From 5be84b4b1a2ac19f51e50dbb87da8c54a75ad869 Mon Sep 17 00:00:00 2001 From: Denis Savosin Date: Tue, 15 Oct 2024 13:23:57 +0700 Subject: [PATCH] rename project --- build.gradle.kts | 2 +- .../demo/http/exceptions/NotFoundException.kt | 3 -- .../http/exceptions/UnprocessableException.kt | 3 -- .../demo/http/responses/NotFoundResponse.kt | 3 -- .../example/demo/providers/ShopProvider.kt | 7 ----- .../com/example/demo/providers/html/Center.kt | 3 -- .../com/example/demo/providers/html/Html.kt | 12 -------- .../com/example/demo/providers/html/TD.kt | 3 -- .../services/database/city/CityService.kt | 19 ------------- .../database/customer/CustomerService.kt | 13 --------- .../exceptions/AlreadyDeletedException.kt | 3 -- .../exceptions/CityNotFoundException.kt | 3 -- .../example/demo/services/kafka/Producer.kt | 9 ------ .../exceptions/InvalidArgumentException.kt | 3 -- .../exceptions/SchemaNotFoundException.kt | 3 -- .../dannecron}/demo/DemoApplication.kt | 2 +- .../dannecron}/demo/config/AppConfig.kt | 28 +++++++++---------- .../demo/config/KafkaConsumerConfig.kt | 10 +++---- .../demo/config/KafkaProducerConfig.kt | 12 ++++---- .../demo/config/properties/KafkaProperties.kt | 4 +-- .../config/properties/ValidationProperties.kt | 4 +-- .../http/controllers/CustomerController.kt | 6 ++-- .../http/controllers/GreetingController.kt | 4 +-- .../http/controllers/ProductController.kt | 24 ++++++++-------- .../demo/http/controllers/ShopController.kt | 8 +++--- .../demo/http/exceptions/ExceptionHandler.kt | 10 +++---- .../demo/http/exceptions/NotFoundException.kt | 3 ++ .../http/exceptions/UnprocessableException.kt | 3 ++ .../http/requests/CreateProductRequest.kt | 2 +- .../demo/http/responses/BadRequestResponse.kt | 2 +- .../demo/http/responses/BaseResponse.kt | 2 +- .../demo/http/responses/NotFoundResponse.kt | 3 ++ .../demo/http/responses/ResponseStatus.kt | 4 +-- .../http/responses/UnprocessableResponse.kt | 4 +-- .../demo/http/responses/page/PageMetaDto.kt | 4 +-- .../demo/http/responses/page/PageResponse.kt | 4 +-- .../dannecron}/demo/models/City.kt | 8 +++--- .../dannecron}/demo/models/Customer.kt | 6 ++-- .../demo/models/CustomerExtended.kt | 2 +- .../dannecron}/demo/models/CustomerLocal.kt | 4 +-- .../dannecron}/demo/models/Order.kt | 4 +-- .../dannecron}/demo/models/Product.kt | 10 +++---- .../dannecron}/demo/models/Shop.kt | 2 +- .../demo/providers/CityRepository.kt | 6 ++-- .../demo/providers/CustomerRepository.kt | 4 +-- .../demo/providers/MockedShopProvider.kt | 6 ++-- .../demo/providers/ProductRepository.kt | 6 ++-- .../dannecron/demo/providers/ShopProvider.kt | 7 +++++ .../demo/providers/html/Attribute.kt | 4 +-- .../dannecron/demo/providers/html/Center.kt | 3 ++ .../dannecron/demo/providers/html/Html.kt | 14 ++++++++++ .../demo/providers/html/HtmlProvider.kt | 14 +++++----- .../demo/providers/html/InnerProduct.kt | 4 +-- .../dannecron/demo/providers/html/TD.kt | 3 ++ .../dannecron}/demo/providers/html/TR.kt | 2 +- .../dannecron}/demo/providers/html/Table.kt | 4 +-- .../dannecron}/demo/providers/html/Tag.kt | 4 +-- .../dannecron}/demo/providers/html/Text.kt | 4 +-- .../services/database/city/CityService.kt | 19 +++++++++++++ .../services/database/city/CityServiceImpl.kt | 12 ++++---- .../database/customer/CustomerService.kt | 13 +++++++++ .../database/customer/CustomerServiceImpl.kt | 12 ++++---- .../exceptions/AlreadyDeletedException.kt | 3 ++ .../exceptions/CityNotFoundException.kt | 3 ++ .../exceptions/ModelNotFoundException.kt | 2 +- .../exceptions/ProductNotFoundException.kt | 2 +- .../database/product/ProductService.kt | 10 +++---- .../database/product/ProductServiceImpl.kt | 14 +++++----- .../demo/services/kafka/Consumer.kt | 8 +++--- .../dannecron/demo/services/kafka/Producer.kt | 9 ++++++ .../demo/services/kafka/ProducerImpl.kt | 12 ++++---- .../demo/services/kafka/dto/CityCreateDto.kt | 2 +- .../demo/services/kafka/dto/ProductDto.kt | 8 +++--- .../exceptions/InvalidArgumentException.kt | 3 ++ .../OffsetDateTimeSerialization.kt | 4 +-- .../serializables/UuidSerialization.kt | 4 +-- .../services/validation/SchemaValidator.kt | 8 +++--- .../services/validation/SchemaValidatorImp.kt | 8 +++--- .../exceptions/ElementNotValidException.kt | 4 +-- .../exceptions/SchemaNotFoundException.kt | 3 ++ .../dannecron}/demo/utils/Extensions.kt | 2 +- .../dannecron}/demo/utils/Logger.kt | 4 +-- src/main/resources/application.yml | 2 +- .../dannecron}/demo/BaseDbTest.kt | 6 ++-- .../dannecron}/demo/BaseUnitTest.kt | 12 ++++---- .../controllers/CustomerControllerTest.kt | 14 +++++----- .../controllers/GreetingControllerTest.kt | 6 ++-- .../http/controllers/ProductControllerTest.kt | 10 +++---- .../http/controllers/ShopControllerTest.kt | 8 +++--- .../database/city/CityServiceImplDbTest.kt | 12 ++++---- .../customer/CustomerServiceImplDbTest.kt | 12 ++++---- .../product/ProductServiceImplDbTest.kt | 12 ++++---- .../product/ProductServiceImplTest.kt | 14 +++++----- .../demo/services/kafka/ConsumerKfkTest.kt | 10 +++---- .../demo/services/kafka/ProducerImplTest.kt | 12 ++++---- .../validation/SchemaValidatorImpTest.kt | 12 ++++---- 96 files changed, 333 insertions(+), 331 deletions(-) delete mode 100644 src/main/kotlin/com/example/demo/http/exceptions/NotFoundException.kt delete mode 100644 src/main/kotlin/com/example/demo/http/exceptions/UnprocessableException.kt delete mode 100644 src/main/kotlin/com/example/demo/http/responses/NotFoundResponse.kt delete mode 100644 src/main/kotlin/com/example/demo/providers/ShopProvider.kt delete mode 100644 src/main/kotlin/com/example/demo/providers/html/Center.kt delete mode 100644 src/main/kotlin/com/example/demo/providers/html/Html.kt delete mode 100644 src/main/kotlin/com/example/demo/providers/html/TD.kt delete mode 100644 src/main/kotlin/com/example/demo/services/database/city/CityService.kt delete mode 100644 src/main/kotlin/com/example/demo/services/database/customer/CustomerService.kt delete mode 100644 src/main/kotlin/com/example/demo/services/database/exceptions/AlreadyDeletedException.kt delete mode 100644 src/main/kotlin/com/example/demo/services/database/exceptions/CityNotFoundException.kt delete mode 100644 src/main/kotlin/com/example/demo/services/kafka/Producer.kt delete mode 100644 src/main/kotlin/com/example/demo/services/kafka/exceptions/InvalidArgumentException.kt delete mode 100644 src/main/kotlin/com/example/demo/services/validation/exceptions/SchemaNotFoundException.kt rename src/main/kotlin/com/{example => github/dannecron}/demo/DemoApplication.kt (87%) rename src/main/kotlin/com/{example => github/dannecron}/demo/config/AppConfig.kt (70%) rename src/main/kotlin/com/{example => github/dannecron}/demo/config/KafkaConsumerConfig.kt (88%) rename src/main/kotlin/com/{example => github/dannecron}/demo/config/KafkaProducerConfig.kt (82%) rename src/main/kotlin/com/{example => github/dannecron}/demo/config/properties/KafkaProperties.kt (92%) rename src/main/kotlin/com/{example => github/dannecron}/demo/config/properties/ValidationProperties.kt (77%) rename src/main/kotlin/com/{example => github/dannecron}/demo/http/controllers/CustomerController.kt (83%) rename src/main/kotlin/com/{example => github/dannecron}/demo/http/controllers/GreetingController.kt (80%) rename src/main/kotlin/com/{example => github/dannecron}/demo/http/controllers/ProductController.kt (80%) rename src/main/kotlin/com/{example => github/dannecron}/demo/http/controllers/ShopController.kt (87%) rename src/main/kotlin/com/{example => github/dannecron}/demo/http/exceptions/ExceptionHandler.kt (87%) create mode 100644 src/main/kotlin/com/github/dannecron/demo/http/exceptions/NotFoundException.kt create mode 100644 src/main/kotlin/com/github/dannecron/demo/http/exceptions/UnprocessableException.kt rename src/main/kotlin/com/{example => github/dannecron}/demo/http/requests/CreateProductRequest.kt (86%) rename src/main/kotlin/com/{example => github/dannecron}/demo/http/responses/BadRequestResponse.kt (68%) rename src/main/kotlin/com/{example => github/dannecron}/demo/http/responses/BaseResponse.kt (72%) create mode 100644 src/main/kotlin/com/github/dannecron/demo/http/responses/NotFoundResponse.kt rename src/main/kotlin/com/{example => github/dannecron}/demo/http/responses/ResponseStatus.kt (81%) rename src/main/kotlin/com/{example => github/dannecron}/demo/http/responses/UnprocessableResponse.kt (82%) rename src/main/kotlin/com/{example => github/dannecron}/demo/http/responses/page/PageMetaDto.kt (68%) rename src/main/kotlin/com/{example => github/dannecron}/demo/http/responses/page/PageResponse.kt (86%) rename src/main/kotlin/com/{example => github/dannecron}/demo/models/City.kt (81%) rename src/main/kotlin/com/{example => github/dannecron}/demo/models/Customer.kt (78%) rename src/main/kotlin/com/{example => github/dannecron}/demo/models/CustomerExtended.kt (77%) rename src/main/kotlin/com/{example => github/dannecron}/demo/models/CustomerLocal.kt (94%) rename src/main/kotlin/com/{example => github/dannecron}/demo/models/Order.kt (57%) rename src/main/kotlin/com/{example => github/dannecron}/demo/models/Product.kt (80%) rename src/main/kotlin/com/{example => github/dannecron}/demo/models/Shop.kt (98%) rename src/main/kotlin/com/{example => github/dannecron}/demo/providers/CityRepository.kt (86%) rename src/main/kotlin/com/{example => github/dannecron}/demo/providers/CustomerRepository.kt (72%) rename src/main/kotlin/com/{example => github/dannecron}/demo/providers/MockedShopProvider.kt (91%) rename src/main/kotlin/com/{example => github/dannecron}/demo/providers/ProductRepository.kt (88%) create mode 100644 src/main/kotlin/com/github/dannecron/demo/providers/ShopProvider.kt rename src/main/kotlin/com/{example => github/dannecron}/demo/providers/html/Attribute.kt (68%) create mode 100644 src/main/kotlin/com/github/dannecron/demo/providers/html/Center.kt create mode 100644 src/main/kotlin/com/github/dannecron/demo/providers/html/Html.kt rename src/main/kotlin/com/{example => github/dannecron}/demo/providers/html/HtmlProvider.kt (71%) rename src/main/kotlin/com/{example => github/dannecron}/demo/providers/html/InnerProduct.kt (84%) create mode 100644 src/main/kotlin/com/github/dannecron/demo/providers/html/TD.kt rename src/main/kotlin/com/{example => github/dannecron}/demo/providers/html/TR.kt (78%) rename src/main/kotlin/com/{example => github/dannecron}/demo/providers/html/Table.kt (51%) rename src/main/kotlin/com/{example => github/dannecron}/demo/providers/html/Tag.kt (87%) rename src/main/kotlin/com/{example => github/dannecron}/demo/providers/html/Text.kt (60%) create mode 100644 src/main/kotlin/com/github/dannecron/demo/services/database/city/CityService.kt rename src/main/kotlin/com/{example => github/dannecron}/demo/services/database/city/CityServiceImpl.kt (80%) create mode 100644 src/main/kotlin/com/github/dannecron/demo/services/database/customer/CustomerService.kt rename src/main/kotlin/com/{example => github/dannecron}/demo/services/database/customer/CustomerServiceImpl.kt (74%) create mode 100644 src/main/kotlin/com/github/dannecron/demo/services/database/exceptions/AlreadyDeletedException.kt create mode 100644 src/main/kotlin/com/github/dannecron/demo/services/database/exceptions/CityNotFoundException.kt rename src/main/kotlin/com/{example => github/dannecron}/demo/services/database/exceptions/ModelNotFoundException.kt (60%) rename src/main/kotlin/com/{example => github/dannecron}/demo/services/database/exceptions/ProductNotFoundException.kt (51%) rename src/main/kotlin/com/{example => github/dannecron}/demo/services/database/product/ProductService.kt (62%) rename src/main/kotlin/com/{example => github/dannecron}/demo/services/database/product/ProductServiceImpl.kt (80%) rename src/main/kotlin/com/{example => github/dannecron}/demo/services/kafka/Consumer.kt (84%) create mode 100644 src/main/kotlin/com/github/dannecron/demo/services/kafka/Producer.kt rename src/main/kotlin/com/{example => github/dannecron}/demo/services/kafka/ProducerImpl.kt (75%) rename src/main/kotlin/com/{example => github/dannecron}/demo/services/kafka/dto/CityCreateDto.kt (80%) rename src/main/kotlin/com/{example => github/dannecron}/demo/services/kafka/dto/ProductDto.kt (82%) create mode 100644 src/main/kotlin/com/github/dannecron/demo/services/kafka/exceptions/InvalidArgumentException.kt rename src/main/kotlin/com/{example => github/dannecron}/demo/services/serializables/OffsetDateTimeSerialization.kt (92%) rename src/main/kotlin/com/{example => github/dannecron}/demo/services/serializables/UuidSerialization.kt (91%) rename src/main/kotlin/com/{example => github/dannecron}/demo/services/validation/SchemaValidator.kt (56%) rename src/main/kotlin/com/{example => github/dannecron}/demo/services/validation/SchemaValidatorImp.kt (83%) rename src/main/kotlin/com/{example => github/dannecron}/demo/services/validation/exceptions/ElementNotValidException.kt (61%) create mode 100644 src/main/kotlin/com/github/dannecron/demo/services/validation/exceptions/SchemaNotFoundException.kt rename src/main/kotlin/com/{example => github/dannecron}/demo/utils/Extensions.kt (84%) rename src/main/kotlin/com/{example => github/dannecron}/demo/utils/Logger.kt (92%) rename src/test/kotlin/com/{example => github/dannecron}/demo/BaseDbTest.kt (87%) rename src/test/kotlin/com/{example => github/dannecron}/demo/BaseUnitTest.kt (75%) rename src/test/kotlin/com/{example => github/dannecron}/demo/http/controllers/CustomerControllerTest.kt (90%) rename src/test/kotlin/com/{example => github/dannecron}/demo/http/controllers/GreetingControllerTest.kt (84%) rename src/test/kotlin/com/{example => github/dannecron}/demo/http/controllers/ProductControllerTest.kt (96%) rename src/test/kotlin/com/{example => github/dannecron}/demo/http/controllers/ShopControllerTest.kt (94%) rename src/test/kotlin/com/{example => github/dannecron}/demo/services/database/city/CityServiceImplDbTest.kt (80%) rename src/test/kotlin/com/{example => github/dannecron}/demo/services/database/customer/CustomerServiceImplDbTest.kt (87%) rename src/test/kotlin/com/{example => github/dannecron}/demo/services/database/product/ProductServiceImplDbTest.kt (84%) rename src/test/kotlin/com/{example => github/dannecron}/demo/services/database/product/ProductServiceImplTest.kt (86%) rename src/test/kotlin/com/{example => github/dannecron}/demo/services/kafka/ConsumerKfkTest.kt (91%) rename src/test/kotlin/com/{example => github/dannecron}/demo/services/kafka/ProducerImplTest.kt (89%) rename src/test/kotlin/com/{example => github/dannecron}/demo/services/validation/SchemaValidatorImpTest.kt (89%) diff --git a/build.gradle.kts b/build.gradle.kts index 9e1b509..cdbd8e5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -10,7 +10,7 @@ plugins { kotlin("plugin.spring") version "1.9.23" } -group = "com.example" +group = "com.github.dannecron.demo" version = "single-version" java { diff --git a/src/main/kotlin/com/example/demo/http/exceptions/NotFoundException.kt b/src/main/kotlin/com/example/demo/http/exceptions/NotFoundException.kt deleted file mode 100644 index 9622937..0000000 --- a/src/main/kotlin/com/example/demo/http/exceptions/NotFoundException.kt +++ /dev/null @@ -1,3 +0,0 @@ -package com.example.demo.http.exceptions - -class NotFoundException: RuntimeException() diff --git a/src/main/kotlin/com/example/demo/http/exceptions/UnprocessableException.kt b/src/main/kotlin/com/example/demo/http/exceptions/UnprocessableException.kt deleted file mode 100644 index 9b75038..0000000 --- a/src/main/kotlin/com/example/demo/http/exceptions/UnprocessableException.kt +++ /dev/null @@ -1,3 +0,0 @@ -package com.example.demo.http.exceptions - -class UnprocessableException(override val message: String): RuntimeException(message) \ No newline at end of file diff --git a/src/main/kotlin/com/example/demo/http/responses/NotFoundResponse.kt b/src/main/kotlin/com/example/demo/http/responses/NotFoundResponse.kt deleted file mode 100644 index f8c5c50..0000000 --- a/src/main/kotlin/com/example/demo/http/responses/NotFoundResponse.kt +++ /dev/null @@ -1,3 +0,0 @@ -package com.example.demo.http.responses - -class NotFoundResponse: BaseResponse(ResponseStatus.NOT_FOUND) \ No newline at end of file diff --git a/src/main/kotlin/com/example/demo/providers/ShopProvider.kt b/src/main/kotlin/com/example/demo/providers/ShopProvider.kt deleted file mode 100644 index e152c11..0000000 --- a/src/main/kotlin/com/example/demo/providers/ShopProvider.kt +++ /dev/null @@ -1,7 +0,0 @@ -package com.example.demo.providers - -import com.example.demo.models.Shop - -interface ShopProvider { - fun getRandomShop(): Shop? -} \ No newline at end of file diff --git a/src/main/kotlin/com/example/demo/providers/html/Center.kt b/src/main/kotlin/com/example/demo/providers/html/Center.kt deleted file mode 100644 index fce6909..0000000 --- a/src/main/kotlin/com/example/demo/providers/html/Center.kt +++ /dev/null @@ -1,3 +0,0 @@ -package com.example.demo.providers.html - -class Center: Tag("center") \ No newline at end of file diff --git a/src/main/kotlin/com/example/demo/providers/html/Html.kt b/src/main/kotlin/com/example/demo/providers/html/Html.kt deleted file mode 100644 index f319a2d..0000000 --- a/src/main/kotlin/com/example/demo/providers/html/Html.kt +++ /dev/null @@ -1,12 +0,0 @@ -package com.example.demo.providers.html - -class Html: Tag("html") - -fun html(init: Html.() -> Unit): Html { - val tag = Html() - tag.init() - return tag -} - -fun Html.table(init : Table.() -> Unit) = doInit(Table(), init) -fun Html.center(init : Center.() -> Unit) = doInit(Center(), init) \ No newline at end of file diff --git a/src/main/kotlin/com/example/demo/providers/html/TD.kt b/src/main/kotlin/com/example/demo/providers/html/TD.kt deleted file mode 100644 index f9a1463..0000000 --- a/src/main/kotlin/com/example/demo/providers/html/TD.kt +++ /dev/null @@ -1,3 +0,0 @@ -package com.example.demo.providers.html - -class TD: Tag("td") \ No newline at end of file diff --git a/src/main/kotlin/com/example/demo/services/database/city/CityService.kt b/src/main/kotlin/com/example/demo/services/database/city/CityService.kt deleted file mode 100644 index 8266e19..0000000 --- a/src/main/kotlin/com/example/demo/services/database/city/CityService.kt +++ /dev/null @@ -1,19 +0,0 @@ -package com.example.demo.services.database.city - -import com.example.demo.models.City -import com.example.demo.services.database.exceptions.CityNotFoundException -import com.example.demo.services.database.exceptions.AlreadyDeletedException -import com.example.demo.services.kafka.dto.CityCreateDto -import org.springframework.stereotype.Service -import java.util.* - -@Service -interface CityService { - fun findByGuid(guid: UUID): City? - - fun create(name: String): City - fun create(kafkaCityDto: CityCreateDto): City - - @Throws(CityNotFoundException::class, AlreadyDeletedException::class) - fun delete(guid: UUID): City -} diff --git a/src/main/kotlin/com/example/demo/services/database/customer/CustomerService.kt b/src/main/kotlin/com/example/demo/services/database/customer/CustomerService.kt deleted file mode 100644 index 7894928..0000000 --- a/src/main/kotlin/com/example/demo/services/database/customer/CustomerService.kt +++ /dev/null @@ -1,13 +0,0 @@ -package com.example.demo.services.database.customer - -import com.example.demo.models.Customer -import com.example.demo.models.CustomerExtended -import com.example.demo.services.database.exceptions.CityNotFoundException -import java.util.* - -interface CustomerService { - fun findByGuid(guid: UUID): CustomerExtended? - - @Throws(CityNotFoundException::class) - fun create(name: String, cityGuid: UUID?): Customer -} diff --git a/src/main/kotlin/com/example/demo/services/database/exceptions/AlreadyDeletedException.kt b/src/main/kotlin/com/example/demo/services/database/exceptions/AlreadyDeletedException.kt deleted file mode 100644 index dde551f..0000000 --- a/src/main/kotlin/com/example/demo/services/database/exceptions/AlreadyDeletedException.kt +++ /dev/null @@ -1,3 +0,0 @@ -package com.example.demo.services.database.exceptions - -class AlreadyDeletedException: RuntimeException() diff --git a/src/main/kotlin/com/example/demo/services/database/exceptions/CityNotFoundException.kt b/src/main/kotlin/com/example/demo/services/database/exceptions/CityNotFoundException.kt deleted file mode 100644 index a8f3283..0000000 --- a/src/main/kotlin/com/example/demo/services/database/exceptions/CityNotFoundException.kt +++ /dev/null @@ -1,3 +0,0 @@ -package com.example.demo.services.database.exceptions - -class CityNotFoundException: ModelNotFoundException("city") diff --git a/src/main/kotlin/com/example/demo/services/kafka/Producer.kt b/src/main/kotlin/com/example/demo/services/kafka/Producer.kt deleted file mode 100644 index 15ed7c2..0000000 --- a/src/main/kotlin/com/example/demo/services/kafka/Producer.kt +++ /dev/null @@ -1,9 +0,0 @@ -package com.example.demo.services.kafka - -import com.example.demo.models.Product -import com.example.demo.services.kafka.exceptions.InvalidArgumentException - -interface Producer { - @Throws(InvalidArgumentException::class) - fun produceProductInfo(topicName: String, product: Product) -} \ No newline at end of file diff --git a/src/main/kotlin/com/example/demo/services/kafka/exceptions/InvalidArgumentException.kt b/src/main/kotlin/com/example/demo/services/kafka/exceptions/InvalidArgumentException.kt deleted file mode 100644 index 0bfe3d0..0000000 --- a/src/main/kotlin/com/example/demo/services/kafka/exceptions/InvalidArgumentException.kt +++ /dev/null @@ -1,3 +0,0 @@ -package com.example.demo.services.kafka.exceptions - -class InvalidArgumentException(argName: String): RuntimeException("invalid argument $argName") \ No newline at end of file diff --git a/src/main/kotlin/com/example/demo/services/validation/exceptions/SchemaNotFoundException.kt b/src/main/kotlin/com/example/demo/services/validation/exceptions/SchemaNotFoundException.kt deleted file mode 100644 index f13db10..0000000 --- a/src/main/kotlin/com/example/demo/services/validation/exceptions/SchemaNotFoundException.kt +++ /dev/null @@ -1,3 +0,0 @@ -package com.example.demo.services.validation.exceptions - -class SchemaNotFoundException: RuntimeException() \ No newline at end of file diff --git a/src/main/kotlin/com/example/demo/DemoApplication.kt b/src/main/kotlin/com/github/dannecron/demo/DemoApplication.kt similarity index 87% rename from src/main/kotlin/com/example/demo/DemoApplication.kt rename to src/main/kotlin/com/github/dannecron/demo/DemoApplication.kt index 7fd8c28..042925d 100644 --- a/src/main/kotlin/com/example/demo/DemoApplication.kt +++ b/src/main/kotlin/com/github/dannecron/demo/DemoApplication.kt @@ -1,4 +1,4 @@ -package com.example.demo +package com.github.dannecron.demo import org.springframework.boot.autoconfigure.SpringBootApplication import org.springframework.boot.runApplication diff --git a/src/main/kotlin/com/example/demo/config/AppConfig.kt b/src/main/kotlin/com/github/dannecron/demo/config/AppConfig.kt similarity index 70% rename from src/main/kotlin/com/example/demo/config/AppConfig.kt rename to src/main/kotlin/com/github/dannecron/demo/config/AppConfig.kt index a3b74b6..5de2fc4 100644 --- a/src/main/kotlin/com/example/demo/config/AppConfig.kt +++ b/src/main/kotlin/com/github/dannecron/demo/config/AppConfig.kt @@ -1,17 +1,17 @@ -package com.example.demo.config +package com.github.dannecron.demo.config -import com.example.demo.config.properties.KafkaProperties -import com.example.demo.config.properties.ValidationProperties -import com.example.demo.providers.* -import com.example.demo.services.database.city.CityService -import com.example.demo.services.database.city.CityServiceImpl -import com.example.demo.services.database.customer.CustomerService -import com.example.demo.services.database.customer.CustomerServiceImpl -import com.example.demo.services.database.product.ProductService -import com.example.demo.services.database.product.ProductServiceImpl -import com.example.demo.services.kafka.Producer -import com.example.demo.services.validation.SchemaValidator -import com.example.demo.services.validation.SchemaValidatorImp +import com.github.dannecron.demo.config.properties.KafkaProperties +import com.github.dannecron.demo.config.properties.ValidationProperties +import com.github.dannecron.demo.providers.* +import com.github.dannecron.demo.services.database.city.CityService +import com.github.dannecron.demo.services.database.city.CityServiceImpl +import com.github.dannecron.demo.services.database.customer.CustomerService +import com.github.dannecron.demo.services.database.customer.CustomerServiceImpl +import com.github.dannecron.demo.services.database.product.ProductService +import com.github.dannecron.demo.services.database.product.ProductServiceImpl +import com.github.dannecron.demo.services.kafka.Producer +import com.github.dannecron.demo.services.validation.SchemaValidator +import com.github.dannecron.demo.services.validation.SchemaValidatorImp import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.databind.SerializationFeature import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule @@ -39,7 +39,7 @@ class AppConfig( } @Bean - fun shopProvider(): ShopProvider = MockedShopProvider() + fun shopProvider(): ShopProvider = com.github.dannecron.demo.providers.MockedShopProvider() @Bean fun productService( diff --git a/src/main/kotlin/com/example/demo/config/KafkaConsumerConfig.kt b/src/main/kotlin/com/github/dannecron/demo/config/KafkaConsumerConfig.kt similarity index 88% rename from src/main/kotlin/com/example/demo/config/KafkaConsumerConfig.kt rename to src/main/kotlin/com/github/dannecron/demo/config/KafkaConsumerConfig.kt index 655d3d8..f2d72e2 100644 --- a/src/main/kotlin/com/example/demo/config/KafkaConsumerConfig.kt +++ b/src/main/kotlin/com/github/dannecron/demo/config/KafkaConsumerConfig.kt @@ -1,8 +1,8 @@ -package com.example.demo.config +package com.github.dannecron.demo.config -import com.example.demo.config.properties.KafkaProperties -import com.example.demo.services.database.city.CityService -import com.example.demo.services.kafka.Consumer +import com.github.dannecron.demo.config.properties.KafkaProperties +import com.github.dannecron.demo.services.database.city.CityService +import com.github.dannecron.demo.services.kafka.Consumer import io.micrometer.core.instrument.MeterRegistry import org.apache.kafka.clients.consumer.ConsumerConfig import org.apache.kafka.common.serialization.StringDeserializer @@ -46,4 +46,4 @@ class KafkaConsumerConfig( return factory } -} \ No newline at end of file +} diff --git a/src/main/kotlin/com/example/demo/config/KafkaProducerConfig.kt b/src/main/kotlin/com/github/dannecron/demo/config/KafkaProducerConfig.kt similarity index 82% rename from src/main/kotlin/com/example/demo/config/KafkaProducerConfig.kt rename to src/main/kotlin/com/github/dannecron/demo/config/KafkaProducerConfig.kt index d7b066e..3bb5758 100644 --- a/src/main/kotlin/com/example/demo/config/KafkaProducerConfig.kt +++ b/src/main/kotlin/com/github/dannecron/demo/config/KafkaProducerConfig.kt @@ -1,9 +1,9 @@ -package com.example.demo.config +package com.github.dannecron.demo.config -import com.example.demo.config.properties.KafkaProperties -import com.example.demo.services.kafka.Producer -import com.example.demo.services.kafka.ProducerImpl -import com.example.demo.services.validation.SchemaValidator +import com.github.dannecron.demo.config.properties.KafkaProperties +import com.github.dannecron.demo.services.kafka.Producer +import com.github.dannecron.demo.services.kafka.ProducerImpl +import com.github.dannecron.demo.services.validation.SchemaValidator import org.apache.kafka.clients.producer.ProducerConfig import org.apache.kafka.common.serialization.StringSerializer import org.springframework.beans.factory.annotation.Autowired @@ -41,4 +41,4 @@ class KafkaProducerConfig( kafkaTemplate, schemaValidator, ) -} \ No newline at end of file +} diff --git a/src/main/kotlin/com/example/demo/config/properties/KafkaProperties.kt b/src/main/kotlin/com/github/dannecron/demo/config/properties/KafkaProperties.kt similarity index 92% rename from src/main/kotlin/com/example/demo/config/properties/KafkaProperties.kt rename to src/main/kotlin/com/github/dannecron/demo/config/properties/KafkaProperties.kt index 248d453..1096c92 100644 --- a/src/main/kotlin/com/example/demo/config/properties/KafkaProperties.kt +++ b/src/main/kotlin/com/github/dannecron/demo/config/properties/KafkaProperties.kt @@ -1,4 +1,4 @@ -package com.example.demo.config.properties +package com.github.dannecron.demo.config.properties import org.springframework.boot.context.properties.ConfigurationProperties import org.springframework.boot.context.properties.bind.ConstructorBinding @@ -23,4 +23,4 @@ data class KafkaProperties @ConstructorBinding constructor( val autoStartup: Boolean, val autoOffsetReset: String, ) -} \ No newline at end of file +} diff --git a/src/main/kotlin/com/example/demo/config/properties/ValidationProperties.kt b/src/main/kotlin/com/github/dannecron/demo/config/properties/ValidationProperties.kt similarity index 77% rename from src/main/kotlin/com/example/demo/config/properties/ValidationProperties.kt rename to src/main/kotlin/com/github/dannecron/demo/config/properties/ValidationProperties.kt index a8b58e9..54698da 100644 --- a/src/main/kotlin/com/example/demo/config/properties/ValidationProperties.kt +++ b/src/main/kotlin/com/github/dannecron/demo/config/properties/ValidationProperties.kt @@ -1,8 +1,8 @@ -package com.example.demo.config.properties +package com.github.dannecron.demo.config.properties import org.springframework.boot.context.properties.ConfigurationProperties @ConfigurationProperties("validation") data class ValidationProperties( val schema: Map -) \ No newline at end of file +) diff --git a/src/main/kotlin/com/example/demo/http/controllers/CustomerController.kt b/src/main/kotlin/com/github/dannecron/demo/http/controllers/CustomerController.kt similarity index 83% rename from src/main/kotlin/com/example/demo/http/controllers/CustomerController.kt rename to src/main/kotlin/com/github/dannecron/demo/http/controllers/CustomerController.kt index 9c4fadf..0e4d033 100644 --- a/src/main/kotlin/com/example/demo/http/controllers/CustomerController.kt +++ b/src/main/kotlin/com/github/dannecron/demo/http/controllers/CustomerController.kt @@ -1,7 +1,7 @@ -package com.example.demo.http.controllers +package com.github.dannecron.demo.http.controllers -import com.example.demo.http.exceptions.NotFoundException -import com.example.demo.services.database.customer.CustomerService +import com.github.dannecron.demo.http.exceptions.NotFoundException +import com.github.dannecron.demo.services.database.customer.CustomerService import org.springframework.beans.factory.annotation.Autowired import org.springframework.http.HttpStatus import org.springframework.http.MediaType diff --git a/src/main/kotlin/com/example/demo/http/controllers/GreetingController.kt b/src/main/kotlin/com/github/dannecron/demo/http/controllers/GreetingController.kt similarity index 80% rename from src/main/kotlin/com/example/demo/http/controllers/GreetingController.kt rename to src/main/kotlin/com/github/dannecron/demo/http/controllers/GreetingController.kt index ea265e4..17538b8 100644 --- a/src/main/kotlin/com/example/demo/http/controllers/GreetingController.kt +++ b/src/main/kotlin/com/github/dannecron/demo/http/controllers/GreetingController.kt @@ -1,6 +1,6 @@ -package com.example.demo.http.controllers +package com.github.dannecron.demo.http.controllers -import com.example.demo.providers.html.renderProductTable +import com.github.dannecron.demo.providers.html.renderProductTable import org.springframework.web.bind.annotation.GetMapping import org.springframework.web.bind.annotation.ResponseBody import org.springframework.web.bind.annotation.RestController diff --git a/src/main/kotlin/com/example/demo/http/controllers/ProductController.kt b/src/main/kotlin/com/github/dannecron/demo/http/controllers/ProductController.kt similarity index 80% rename from src/main/kotlin/com/example/demo/http/controllers/ProductController.kt rename to src/main/kotlin/com/github/dannecron/demo/http/controllers/ProductController.kt index 8c21872..4774b1b 100644 --- a/src/main/kotlin/com/example/demo/http/controllers/ProductController.kt +++ b/src/main/kotlin/com/github/dannecron/demo/http/controllers/ProductController.kt @@ -1,16 +1,16 @@ -package com.example.demo.http.controllers +package com.github.dannecron.demo.http.controllers -import com.example.demo.http.exceptions.NotFoundException -import com.example.demo.http.exceptions.UnprocessableException -import com.example.demo.http.requests.CreateProductRequest -import com.example.demo.http.responses.NotFoundResponse -import com.example.demo.http.responses.makeOkResponse -import com.example.demo.http.responses.page.PageResponse -import com.example.demo.models.Product -import com.example.demo.services.database.exceptions.AlreadyDeletedException -import com.example.demo.services.database.product.ProductService -import com.example.demo.services.database.exceptions.ProductNotFoundException -import com.example.demo.services.kafka.exceptions.InvalidArgumentException +import com.github.dannecron.demo.http.exceptions.NotFoundException +import com.github.dannecron.demo.http.exceptions.UnprocessableException +import com.github.dannecron.demo.http.requests.CreateProductRequest +import com.github.dannecron.demo.http.responses.NotFoundResponse +import com.github.dannecron.demo.http.responses.makeOkResponse +import com.github.dannecron.demo.http.responses.page.PageResponse +import com.github.dannecron.demo.models.Product +import com.github.dannecron.demo.services.database.exceptions.AlreadyDeletedException +import com.github.dannecron.demo.services.database.product.ProductService +import com.github.dannecron.demo.services.database.exceptions.ProductNotFoundException +import com.github.dannecron.demo.services.kafka.exceptions.InvalidArgumentException import io.swagger.v3.oas.annotations.media.Content import io.swagger.v3.oas.annotations.media.Schema import io.swagger.v3.oas.annotations.responses.ApiResponse diff --git a/src/main/kotlin/com/example/demo/http/controllers/ShopController.kt b/src/main/kotlin/com/github/dannecron/demo/http/controllers/ShopController.kt similarity index 87% rename from src/main/kotlin/com/example/demo/http/controllers/ShopController.kt rename to src/main/kotlin/com/github/dannecron/demo/http/controllers/ShopController.kt index c10b43d..58116d0 100644 --- a/src/main/kotlin/com/example/demo/http/controllers/ShopController.kt +++ b/src/main/kotlin/com/github/dannecron/demo/http/controllers/ShopController.kt @@ -1,7 +1,7 @@ -package com.example.demo.http.controllers +package com.github.dannecron.demo.http.controllers -import com.example.demo.http.exceptions.NotFoundException -import com.example.demo.providers.ShopProvider +import com.github.dannecron.demo.http.exceptions.NotFoundException +import com.github.dannecron.demo.providers.ShopProvider import jakarta.servlet.http.HttpServletResponse import kotlinx.serialization.json.Json import kotlinx.serialization.json.encodeToJsonElement @@ -29,4 +29,4 @@ class ShopController ( ) )).toString() } -} \ No newline at end of file +} diff --git a/src/main/kotlin/com/example/demo/http/exceptions/ExceptionHandler.kt b/src/main/kotlin/com/github/dannecron/demo/http/exceptions/ExceptionHandler.kt similarity index 87% rename from src/main/kotlin/com/example/demo/http/exceptions/ExceptionHandler.kt rename to src/main/kotlin/com/github/dannecron/demo/http/exceptions/ExceptionHandler.kt index ff3b060..3a90dde 100644 --- a/src/main/kotlin/com/example/demo/http/exceptions/ExceptionHandler.kt +++ b/src/main/kotlin/com/github/dannecron/demo/http/exceptions/ExceptionHandler.kt @@ -1,8 +1,8 @@ -package com.example.demo.http.exceptions +package com.github.dannecron.demo.http.exceptions -import com.example.demo.http.responses.BadRequestResponse -import com.example.demo.http.responses.NotFoundResponse -import com.example.demo.http.responses.UnprocessableResponse +import com.github.dannecron.demo.http.responses.BadRequestResponse +import com.github.dannecron.demo.http.responses.NotFoundResponse +import com.github.dannecron.demo.http.responses.UnprocessableResponse import org.springframework.http.HttpStatus import org.springframework.http.ResponseEntity import org.springframework.http.converter.HttpMessageNotReadableException @@ -42,4 +42,4 @@ class ExceptionHandler { UnprocessableResponse(exception.javaClass.name, exception.allErrors), HttpStatus.UNPROCESSABLE_ENTITY, ) -} \ No newline at end of file +} diff --git a/src/main/kotlin/com/github/dannecron/demo/http/exceptions/NotFoundException.kt b/src/main/kotlin/com/github/dannecron/demo/http/exceptions/NotFoundException.kt new file mode 100644 index 0000000..c6cb577 --- /dev/null +++ b/src/main/kotlin/com/github/dannecron/demo/http/exceptions/NotFoundException.kt @@ -0,0 +1,3 @@ +package com.github.dannecron.demo.http.exceptions + +class NotFoundException: RuntimeException() diff --git a/src/main/kotlin/com/github/dannecron/demo/http/exceptions/UnprocessableException.kt b/src/main/kotlin/com/github/dannecron/demo/http/exceptions/UnprocessableException.kt new file mode 100644 index 0000000..b1693a6 --- /dev/null +++ b/src/main/kotlin/com/github/dannecron/demo/http/exceptions/UnprocessableException.kt @@ -0,0 +1,3 @@ +package com.github.dannecron.demo.http.exceptions + +class UnprocessableException(override val message: String): RuntimeException(message) diff --git a/src/main/kotlin/com/example/demo/http/requests/CreateProductRequest.kt b/src/main/kotlin/com/github/dannecron/demo/http/requests/CreateProductRequest.kt similarity index 86% rename from src/main/kotlin/com/example/demo/http/requests/CreateProductRequest.kt rename to src/main/kotlin/com/github/dannecron/demo/http/requests/CreateProductRequest.kt index c88e101..f4ae410 100644 --- a/src/main/kotlin/com/example/demo/http/requests/CreateProductRequest.kt +++ b/src/main/kotlin/com/github/dannecron/demo/http/requests/CreateProductRequest.kt @@ -1,4 +1,4 @@ -package com.example.demo.http.requests +package com.github.dannecron.demo.http.requests import jakarta.validation.constraints.Min import jakarta.validation.constraints.NotBlank diff --git a/src/main/kotlin/com/example/demo/http/responses/BadRequestResponse.kt b/src/main/kotlin/com/github/dannecron/demo/http/responses/BadRequestResponse.kt similarity index 68% rename from src/main/kotlin/com/example/demo/http/responses/BadRequestResponse.kt rename to src/main/kotlin/com/github/dannecron/demo/http/responses/BadRequestResponse.kt index 07d2f3e..25958d8 100644 --- a/src/main/kotlin/com/example/demo/http/responses/BadRequestResponse.kt +++ b/src/main/kotlin/com/github/dannecron/demo/http/responses/BadRequestResponse.kt @@ -1,4 +1,4 @@ -package com.example.demo.http.responses +package com.github.dannecron.demo.http.responses data class BadRequestResponse( val cause: String, diff --git a/src/main/kotlin/com/example/demo/http/responses/BaseResponse.kt b/src/main/kotlin/com/github/dannecron/demo/http/responses/BaseResponse.kt similarity index 72% rename from src/main/kotlin/com/example/demo/http/responses/BaseResponse.kt rename to src/main/kotlin/com/github/dannecron/demo/http/responses/BaseResponse.kt index 5692e63..e36d6c1 100644 --- a/src/main/kotlin/com/example/demo/http/responses/BaseResponse.kt +++ b/src/main/kotlin/com/github/dannecron/demo/http/responses/BaseResponse.kt @@ -1,4 +1,4 @@ -package com.example.demo.http.responses +package com.github.dannecron.demo.http.responses open class BaseResponse(val status: ResponseStatus) diff --git a/src/main/kotlin/com/github/dannecron/demo/http/responses/NotFoundResponse.kt b/src/main/kotlin/com/github/dannecron/demo/http/responses/NotFoundResponse.kt new file mode 100644 index 0000000..0a449d7 --- /dev/null +++ b/src/main/kotlin/com/github/dannecron/demo/http/responses/NotFoundResponse.kt @@ -0,0 +1,3 @@ +package com.github.dannecron.demo.http.responses + +class NotFoundResponse: BaseResponse(ResponseStatus.NOT_FOUND) diff --git a/src/main/kotlin/com/example/demo/http/responses/ResponseStatus.kt b/src/main/kotlin/com/github/dannecron/demo/http/responses/ResponseStatus.kt similarity index 81% rename from src/main/kotlin/com/example/demo/http/responses/ResponseStatus.kt rename to src/main/kotlin/com/github/dannecron/demo/http/responses/ResponseStatus.kt index 8b3572a..031ec28 100644 --- a/src/main/kotlin/com/example/demo/http/responses/ResponseStatus.kt +++ b/src/main/kotlin/com/github/dannecron/demo/http/responses/ResponseStatus.kt @@ -1,4 +1,4 @@ -package com.example.demo.http.responses +package com.github.dannecron.demo.http.responses import com.fasterxml.jackson.annotation.JsonValue @@ -7,4 +7,4 @@ enum class ResponseStatus(@JsonValue val status: String) { NOT_FOUND("not found"), BAD_REQUEST("bad request"), UNPROCESSABLE("unprocessable"); -} \ No newline at end of file +} diff --git a/src/main/kotlin/com/example/demo/http/responses/UnprocessableResponse.kt b/src/main/kotlin/com/github/dannecron/demo/http/responses/UnprocessableResponse.kt similarity index 82% rename from src/main/kotlin/com/example/demo/http/responses/UnprocessableResponse.kt rename to src/main/kotlin/com/github/dannecron/demo/http/responses/UnprocessableResponse.kt index 8a96e50..1627026 100644 --- a/src/main/kotlin/com/example/demo/http/responses/UnprocessableResponse.kt +++ b/src/main/kotlin/com/github/dannecron/demo/http/responses/UnprocessableResponse.kt @@ -1,4 +1,4 @@ -package com.example.demo.http.responses +package com.github.dannecron.demo.http.responses import org.springframework.validation.ObjectError @@ -7,4 +7,4 @@ class UnprocessableResponse( val errors: List? ): BaseResponse(status = ResponseStatus.UNPROCESSABLE) { constructor(cause: String): this(cause, null) -} \ No newline at end of file +} diff --git a/src/main/kotlin/com/example/demo/http/responses/page/PageMetaDto.kt b/src/main/kotlin/com/github/dannecron/demo/http/responses/page/PageMetaDto.kt similarity index 68% rename from src/main/kotlin/com/example/demo/http/responses/page/PageMetaDto.kt rename to src/main/kotlin/com/github/dannecron/demo/http/responses/page/PageMetaDto.kt index d8a6356..feedb41 100644 --- a/src/main/kotlin/com/example/demo/http/responses/page/PageMetaDto.kt +++ b/src/main/kotlin/com/github/dannecron/demo/http/responses/page/PageMetaDto.kt @@ -1,4 +1,4 @@ -package com.example.demo.http.responses.page +package com.github.dannecron.demo.http.responses.page import kotlinx.serialization.Serializable @@ -6,4 +6,4 @@ import kotlinx.serialization.Serializable data class PageMetaDto( val total: Long, val pages: Int, -) \ No newline at end of file +) diff --git a/src/main/kotlin/com/example/demo/http/responses/page/PageResponse.kt b/src/main/kotlin/com/github/dannecron/demo/http/responses/page/PageResponse.kt similarity index 86% rename from src/main/kotlin/com/example/demo/http/responses/page/PageResponse.kt rename to src/main/kotlin/com/github/dannecron/demo/http/responses/page/PageResponse.kt index 3bb7040..de71300 100644 --- a/src/main/kotlin/com/example/demo/http/responses/page/PageResponse.kt +++ b/src/main/kotlin/com/github/dannecron/demo/http/responses/page/PageResponse.kt @@ -1,4 +1,4 @@ -package com.example.demo.http.responses.page +package com.github.dannecron.demo.http.responses.page import kotlinx.serialization.Serializable import org.springframework.data.domain.Page @@ -15,4 +15,4 @@ data class PageResponse( pages = page.totalPages ) ) -} \ No newline at end of file +} diff --git a/src/main/kotlin/com/example/demo/models/City.kt b/src/main/kotlin/com/github/dannecron/demo/models/City.kt similarity index 81% rename from src/main/kotlin/com/example/demo/models/City.kt rename to src/main/kotlin/com/github/dannecron/demo/models/City.kt index aa7b355..7db87c4 100644 --- a/src/main/kotlin/com/example/demo/models/City.kt +++ b/src/main/kotlin/com/github/dannecron/demo/models/City.kt @@ -1,7 +1,7 @@ -package com.example.demo.models +package com.github.dannecron.demo.models -import com.example.demo.services.serializables.OffsetDateTimeSerialization -import com.example.demo.services.serializables.UuidSerialization +import com.github.dannecron.demo.services.serializables.OffsetDateTimeSerialization +import com.github.dannecron.demo.services.serializables.UuidSerialization import kotlinx.serialization.Serializable import org.springframework.data.annotation.Id import org.springframework.data.relational.core.mapping.Column @@ -28,4 +28,4 @@ data class City( val deletedAt: OffsetDateTime?, ) { fun isDeleted(): Boolean = deletedAt != null -} \ No newline at end of file +} diff --git a/src/main/kotlin/com/example/demo/models/Customer.kt b/src/main/kotlin/com/github/dannecron/demo/models/Customer.kt similarity index 78% rename from src/main/kotlin/com/example/demo/models/Customer.kt rename to src/main/kotlin/com/github/dannecron/demo/models/Customer.kt index 13f55c7..972ff37 100644 --- a/src/main/kotlin/com/example/demo/models/Customer.kt +++ b/src/main/kotlin/com/github/dannecron/demo/models/Customer.kt @@ -1,7 +1,7 @@ -package com.example.demo.models +package com.github.dannecron.demo.models -import com.example.demo.services.serializables.OffsetDateTimeSerialization -import com.example.demo.services.serializables.UuidSerialization +import com.github.dannecron.demo.services.serializables.OffsetDateTimeSerialization +import com.github.dannecron.demo.services.serializables.UuidSerialization import kotlinx.serialization.Serializable import org.springframework.data.annotation.Id import org.springframework.data.relational.core.mapping.Column diff --git a/src/main/kotlin/com/example/demo/models/CustomerExtended.kt b/src/main/kotlin/com/github/dannecron/demo/models/CustomerExtended.kt similarity index 77% rename from src/main/kotlin/com/example/demo/models/CustomerExtended.kt rename to src/main/kotlin/com/github/dannecron/demo/models/CustomerExtended.kt index 467c838..7ca4858 100644 --- a/src/main/kotlin/com/example/demo/models/CustomerExtended.kt +++ b/src/main/kotlin/com/github/dannecron/demo/models/CustomerExtended.kt @@ -1,4 +1,4 @@ -package com.example.demo.models +package com.github.dannecron.demo.models import kotlinx.serialization.Serializable diff --git a/src/main/kotlin/com/example/demo/models/CustomerLocal.kt b/src/main/kotlin/com/github/dannecron/demo/models/CustomerLocal.kt similarity index 94% rename from src/main/kotlin/com/example/demo/models/CustomerLocal.kt rename to src/main/kotlin/com/github/dannecron/demo/models/CustomerLocal.kt index ff89430..78e6273 100644 --- a/src/main/kotlin/com/example/demo/models/CustomerLocal.kt +++ b/src/main/kotlin/com/github/dannecron/demo/models/CustomerLocal.kt @@ -1,4 +1,4 @@ -package com.example.demo.models +package com.github.dannecron.demo.models data class CustomerLocal(val name: String, val city: City, val orders: List) { /** @@ -13,4 +13,4 @@ data class CustomerLocal(val name: String, val city: City, val orders: List = orders.flatMap { order -> order.products }.toSet() fun getTotalOrderPrice(): Double = orders.flatMap { ord -> ord.products }.sumOf { pr -> pr.getPriceDouble()} -} \ No newline at end of file +} diff --git a/src/main/kotlin/com/example/demo/models/Order.kt b/src/main/kotlin/com/github/dannecron/demo/models/Order.kt similarity index 57% rename from src/main/kotlin/com/example/demo/models/Order.kt rename to src/main/kotlin/com/github/dannecron/demo/models/Order.kt index 66ccc24..6e34fd4 100644 --- a/src/main/kotlin/com/example/demo/models/Order.kt +++ b/src/main/kotlin/com/github/dannecron/demo/models/Order.kt @@ -1,3 +1,3 @@ -package com.example.demo.models +package com.github.dannecron.demo.models -data class Order(val products: List, val isDelivered: Boolean) \ No newline at end of file +data class Order(val products: List, val isDelivered: Boolean) diff --git a/src/main/kotlin/com/example/demo/models/Product.kt b/src/main/kotlin/com/github/dannecron/demo/models/Product.kt similarity index 80% rename from src/main/kotlin/com/example/demo/models/Product.kt rename to src/main/kotlin/com/github/dannecron/demo/models/Product.kt index 42bfeee..52921e7 100644 --- a/src/main/kotlin/com/example/demo/models/Product.kt +++ b/src/main/kotlin/com/github/dannecron/demo/models/Product.kt @@ -1,9 +1,9 @@ -package com.example.demo.models +package com.github.dannecron.demo.models -import com.example.demo.services.serializables.OffsetDateTimeSerialization -import com.example.demo.services.serializables.UuidSerialization -import com.example.demo.utils.roundTo +import com.github.dannecron.demo.services.serializables.OffsetDateTimeSerialization +import com.github.dannecron.demo.services.serializables.UuidSerialization +import com.github.dannecron.demo.utils.roundTo import kotlinx.serialization.Serializable import org.springframework.data.annotation.Id import org.springframework.data.relational.core.mapping.Column @@ -34,4 +34,4 @@ data class Product( fun getPriceDouble(): Double = (price.toDouble() / 100).roundTo(2) fun isDeleted(): Boolean = deletedAt != null -} \ No newline at end of file +} diff --git a/src/main/kotlin/com/example/demo/models/Shop.kt b/src/main/kotlin/com/github/dannecron/demo/models/Shop.kt similarity index 98% rename from src/main/kotlin/com/example/demo/models/Shop.kt rename to src/main/kotlin/com/github/dannecron/demo/models/Shop.kt index b6118c2..a374db6 100644 --- a/src/main/kotlin/com/example/demo/models/Shop.kt +++ b/src/main/kotlin/com/github/dannecron/demo/models/Shop.kt @@ -1,4 +1,4 @@ -package com.example.demo.models +package com.github.dannecron.demo.models data class Shop(val name: String, val customers: List) { fun checkAllCustomersAreFrom(city: City): Boolean = customers.count { cus -> cus.city == city } == customers.count() diff --git a/src/main/kotlin/com/example/demo/providers/CityRepository.kt b/src/main/kotlin/com/github/dannecron/demo/providers/CityRepository.kt similarity index 86% rename from src/main/kotlin/com/example/demo/providers/CityRepository.kt rename to src/main/kotlin/com/github/dannecron/demo/providers/CityRepository.kt index f004a36..145d311 100644 --- a/src/main/kotlin/com/example/demo/providers/CityRepository.kt +++ b/src/main/kotlin/com/github/dannecron/demo/providers/CityRepository.kt @@ -1,6 +1,6 @@ -package com.example.demo.providers +package com.github.dannecron.demo.providers -import com.example.demo.models.City +import com.github.dannecron.demo.models.City import org.springframework.data.jdbc.repository.query.Query import org.springframework.data.repository.CrudRepository import org.springframework.data.repository.query.Param @@ -14,4 +14,4 @@ interface CityRepository: CrudRepository { @Query(value = "UPDATE City SET deleted_at = :deletedAt WHERE guid = :guid RETURNING *") fun softDelete(@Param("guid") guid: UUID, @Param("deletedAt") deletedAt: OffsetDateTime): City? -} \ No newline at end of file +} diff --git a/src/main/kotlin/com/example/demo/providers/CustomerRepository.kt b/src/main/kotlin/com/github/dannecron/demo/providers/CustomerRepository.kt similarity index 72% rename from src/main/kotlin/com/example/demo/providers/CustomerRepository.kt rename to src/main/kotlin/com/github/dannecron/demo/providers/CustomerRepository.kt index 17f5622..541ecdb 100644 --- a/src/main/kotlin/com/example/demo/providers/CustomerRepository.kt +++ b/src/main/kotlin/com/github/dannecron/demo/providers/CustomerRepository.kt @@ -1,6 +1,6 @@ -package com.example.demo.providers +package com.github.dannecron.demo.providers -import com.example.demo.models.Customer +import com.github.dannecron.demo.models.Customer import org.springframework.data.repository.CrudRepository import org.springframework.stereotype.Repository import java.util.* diff --git a/src/main/kotlin/com/example/demo/providers/MockedShopProvider.kt b/src/main/kotlin/com/github/dannecron/demo/providers/MockedShopProvider.kt similarity index 91% rename from src/main/kotlin/com/example/demo/providers/MockedShopProvider.kt rename to src/main/kotlin/com/github/dannecron/demo/providers/MockedShopProvider.kt index 3deeded..b122901 100644 --- a/src/main/kotlin/com/example/demo/providers/MockedShopProvider.kt +++ b/src/main/kotlin/com/github/dannecron/demo/providers/MockedShopProvider.kt @@ -1,10 +1,10 @@ -package com.example.demo.providers +package com.github.dannecron.demo.providers -import com.example.demo.models.* +import com.github.dannecron.demo.models.* import java.time.OffsetDateTime import java.util.* -class MockedShopProvider: ShopProvider { +class MockedShopProvider: com.github.dannecron.demo.providers.ShopProvider { override fun getRandomShop(): Shop? { val productOne = makeProduct(id = 1, name = "one", price = 11.2) val productTwo = makeProduct(id = 2, name = "two", price = 13.2) diff --git a/src/main/kotlin/com/example/demo/providers/ProductRepository.kt b/src/main/kotlin/com/github/dannecron/demo/providers/ProductRepository.kt similarity index 88% rename from src/main/kotlin/com/example/demo/providers/ProductRepository.kt rename to src/main/kotlin/com/github/dannecron/demo/providers/ProductRepository.kt index 83e4798..83c0d74 100644 --- a/src/main/kotlin/com/example/demo/providers/ProductRepository.kt +++ b/src/main/kotlin/com/github/dannecron/demo/providers/ProductRepository.kt @@ -1,6 +1,6 @@ -package com.example.demo.providers +package com.github.dannecron.demo.providers -import com.example.demo.models.Product +import com.github.dannecron.demo.models.Product import org.springframework.data.jdbc.repository.query.Query import org.springframework.data.repository.CrudRepository import org.springframework.data.repository.PagingAndSortingRepository @@ -15,4 +15,4 @@ interface ProductRepository: CrudRepository, PagingAndSortingRepo @Query(value = "UPDATE Product SET deleted_at = :deletedAt WHERE guid = :guid RETURNING *") fun softDelete(@Param("guid") guid: UUID, @Param("deletedAt") deletedAt: OffsetDateTime): Product? -} \ No newline at end of file +} diff --git a/src/main/kotlin/com/github/dannecron/demo/providers/ShopProvider.kt b/src/main/kotlin/com/github/dannecron/demo/providers/ShopProvider.kt new file mode 100644 index 0000000..ea7e179 --- /dev/null +++ b/src/main/kotlin/com/github/dannecron/demo/providers/ShopProvider.kt @@ -0,0 +1,7 @@ +package com.github.dannecron.demo.providers + +import com.github.dannecron.demo.models.Shop + +interface ShopProvider { + fun getRandomShop(): Shop? +} diff --git a/src/main/kotlin/com/example/demo/providers/html/Attribute.kt b/src/main/kotlin/com/github/dannecron/demo/providers/html/Attribute.kt similarity index 68% rename from src/main/kotlin/com/example/demo/providers/html/Attribute.kt rename to src/main/kotlin/com/github/dannecron/demo/providers/html/Attribute.kt index a1a1bbd..aa78c02 100644 --- a/src/main/kotlin/com/example/demo/providers/html/Attribute.kt +++ b/src/main/kotlin/com/github/dannecron/demo/providers/html/Attribute.kt @@ -1,5 +1,5 @@ -package com.example.demo.providers.html +package com.github.dannecron.demo.providers.html class Attribute(val name : String, val value : String) { override fun toString() = """$name="$value" """ -} \ No newline at end of file +} diff --git a/src/main/kotlin/com/github/dannecron/demo/providers/html/Center.kt b/src/main/kotlin/com/github/dannecron/demo/providers/html/Center.kt new file mode 100644 index 0000000..d343283 --- /dev/null +++ b/src/main/kotlin/com/github/dannecron/demo/providers/html/Center.kt @@ -0,0 +1,3 @@ +package com.github.dannecron.demo.providers.html + +class Center: Tag("center") diff --git a/src/main/kotlin/com/github/dannecron/demo/providers/html/Html.kt b/src/main/kotlin/com/github/dannecron/demo/providers/html/Html.kt new file mode 100644 index 0000000..5f6a8e8 --- /dev/null +++ b/src/main/kotlin/com/github/dannecron/demo/providers/html/Html.kt @@ -0,0 +1,14 @@ +package com.github.dannecron.demo.providers.html + +class Html: com.github.dannecron.demo.providers.html.Tag("html") + +fun html(init: com.github.dannecron.demo.providers.html.Html.() -> Unit): com.github.dannecron.demo.providers.html.Html { + val tag = com.github.dannecron.demo.providers.html.Html() + tag.init() + return tag +} + +fun com.github.dannecron.demo.providers.html.Html.table(init : com.github.dannecron.demo.providers.html.Table.() -> Unit) = doInit( + com.github.dannecron.demo.providers.html.Table(), init) +fun com.github.dannecron.demo.providers.html.Html.center(init : com.github.dannecron.demo.providers.html.Center.() -> Unit) = doInit( + com.github.dannecron.demo.providers.html.Center(), init) diff --git a/src/main/kotlin/com/example/demo/providers/html/HtmlProvider.kt b/src/main/kotlin/com/github/dannecron/demo/providers/html/HtmlProvider.kt similarity index 71% rename from src/main/kotlin/com/example/demo/providers/html/HtmlProvider.kt rename to src/main/kotlin/com/github/dannecron/demo/providers/html/HtmlProvider.kt index deae82d..272190d 100644 --- a/src/main/kotlin/com/example/demo/providers/html/HtmlProvider.kt +++ b/src/main/kotlin/com/github/dannecron/demo/providers/html/HtmlProvider.kt @@ -1,12 +1,12 @@ -package com.example.demo.providers.html +package com.github.dannecron.demo.providers.html fun getTitleColor() = "#b9c9fe" fun getCellColor(index: Int, row: Int) = if ((index + row) %2 == 0) "#dce4ff" else "#eff2ff" fun renderProductTable(): String { - return html { + return com.github.dannecron.demo.providers.html.html { table { - tr (color = getTitleColor()) { + tr(color = getTitleColor()) { td { text("Product") @@ -22,17 +22,17 @@ fun renderProductTable(): String { val products = getInnerProducts() for ((i, product) in products.withIndex()) { tr { - td (color = getCellColor(0, i+1)) { + td(color = getCellColor(0, i + 1)) { text(product.description) } - td (color = getCellColor(1, i+1)) { + td(color = getCellColor(1, i + 1)) { text(product.price) } - td (color = getCellColor(2, i+1)) { + td(color = getCellColor(2, i + 1)) { text(product.popularity) } } } } }.toString() -} \ No newline at end of file +} diff --git a/src/main/kotlin/com/example/demo/providers/html/InnerProduct.kt b/src/main/kotlin/com/github/dannecron/demo/providers/html/InnerProduct.kt similarity index 84% rename from src/main/kotlin/com/example/demo/providers/html/InnerProduct.kt rename to src/main/kotlin/com/github/dannecron/demo/providers/html/InnerProduct.kt index 92cbf31..aca8c53 100644 --- a/src/main/kotlin/com/example/demo/providers/html/InnerProduct.kt +++ b/src/main/kotlin/com/github/dannecron/demo/providers/html/InnerProduct.kt @@ -1,4 +1,4 @@ -package com.example.demo.providers.html +package com.github.dannecron.demo.providers.html data class InnerProduct(val description: String, val price: Double, val popularity: Int) @@ -8,4 +8,4 @@ fun getInnerProducts(): Set { InnerProduct("two", 13.0, 20), InnerProduct("three", 14.0, 50) ) -} \ No newline at end of file +} diff --git a/src/main/kotlin/com/github/dannecron/demo/providers/html/TD.kt b/src/main/kotlin/com/github/dannecron/demo/providers/html/TD.kt new file mode 100644 index 0000000..c497411 --- /dev/null +++ b/src/main/kotlin/com/github/dannecron/demo/providers/html/TD.kt @@ -0,0 +1,3 @@ +package com.github.dannecron.demo.providers.html + +class TD: Tag("td") diff --git a/src/main/kotlin/com/example/demo/providers/html/TR.kt b/src/main/kotlin/com/github/dannecron/demo/providers/html/TR.kt similarity index 78% rename from src/main/kotlin/com/example/demo/providers/html/TR.kt rename to src/main/kotlin/com/github/dannecron/demo/providers/html/TR.kt index 42bd7d3..8ba2c8a 100644 --- a/src/main/kotlin/com/example/demo/providers/html/TR.kt +++ b/src/main/kotlin/com/github/dannecron/demo/providers/html/TR.kt @@ -1,4 +1,4 @@ -package com.example.demo.providers.html +package com.github.dannecron.demo.providers.html class TR: Tag("tr") diff --git a/src/main/kotlin/com/example/demo/providers/html/Table.kt b/src/main/kotlin/com/github/dannecron/demo/providers/html/Table.kt similarity index 51% rename from src/main/kotlin/com/example/demo/providers/html/Table.kt rename to src/main/kotlin/com/github/dannecron/demo/providers/html/Table.kt index f431ebe..765126f 100644 --- a/src/main/kotlin/com/example/demo/providers/html/Table.kt +++ b/src/main/kotlin/com/github/dannecron/demo/providers/html/Table.kt @@ -1,5 +1,5 @@ -package com.example.demo.providers.html +package com.github.dannecron.demo.providers.html class Table: Tag("table") -fun Table.tr(color: String? = null, init : TR.() -> Unit) = doInit(TR(), init).set("bgcolor", color) \ No newline at end of file +fun Table.tr(color: String? = null, init : TR.() -> Unit) = doInit(TR(), init).set("bgcolor", color) diff --git a/src/main/kotlin/com/example/demo/providers/html/Tag.kt b/src/main/kotlin/com/github/dannecron/demo/providers/html/Tag.kt similarity index 87% rename from src/main/kotlin/com/example/demo/providers/html/Tag.kt rename to src/main/kotlin/com/github/dannecron/demo/providers/html/Tag.kt index 3b75fef..9f1d676 100644 --- a/src/main/kotlin/com/example/demo/providers/html/Tag.kt +++ b/src/main/kotlin/com/github/dannecron/demo/providers/html/Tag.kt @@ -1,4 +1,4 @@ -package com.example.demo.providers.html +package com.github.dannecron.demo.providers.html open class Tag(val name: String) { val children: MutableList = ArrayList() @@ -25,4 +25,4 @@ fun Tag.doInit(tag: T, init: T.() -> Unit): T { return tag } -fun Tag.text(s : Any?) = doInit(Text(s.toString()), {}) \ No newline at end of file +fun Tag.text(s : Any?) = doInit(Text(s.toString()), {}) diff --git a/src/main/kotlin/com/example/demo/providers/html/Text.kt b/src/main/kotlin/com/github/dannecron/demo/providers/html/Text.kt similarity index 60% rename from src/main/kotlin/com/example/demo/providers/html/Text.kt rename to src/main/kotlin/com/github/dannecron/demo/providers/html/Text.kt index 1464300..bcb4f79 100644 --- a/src/main/kotlin/com/example/demo/providers/html/Text.kt +++ b/src/main/kotlin/com/github/dannecron/demo/providers/html/Text.kt @@ -1,5 +1,5 @@ -package com.example.demo.providers.html +package com.github.dannecron.demo.providers.html class Text(val text: String): Tag("b") { override fun toString() = text -} \ No newline at end of file +} diff --git a/src/main/kotlin/com/github/dannecron/demo/services/database/city/CityService.kt b/src/main/kotlin/com/github/dannecron/demo/services/database/city/CityService.kt new file mode 100644 index 0000000..55cbfc1 --- /dev/null +++ b/src/main/kotlin/com/github/dannecron/demo/services/database/city/CityService.kt @@ -0,0 +1,19 @@ +package com.github.dannecron.demo.services.database.city + +import com.github.dannecron.demo.models.City +import com.github.dannecron.demo.services.database.exceptions.CityNotFoundException +import com.github.dannecron.demo.services.database.exceptions.AlreadyDeletedException +import com.github.dannecron.demo.services.kafka.dto.CityCreateDto +import org.springframework.stereotype.Service +import java.util.* + +@Service +interface CityService { + fun findByGuid(guid: UUID): City? + + fun create(name: String): City + fun create(kafkaCityDto: CityCreateDto): City + + @Throws(CityNotFoundException::class, AlreadyDeletedException::class) + fun delete(guid: UUID): City +} diff --git a/src/main/kotlin/com/example/demo/services/database/city/CityServiceImpl.kt b/src/main/kotlin/com/github/dannecron/demo/services/database/city/CityServiceImpl.kt similarity index 80% rename from src/main/kotlin/com/example/demo/services/database/city/CityServiceImpl.kt rename to src/main/kotlin/com/github/dannecron/demo/services/database/city/CityServiceImpl.kt index dcbb0bb..4f08cd2 100644 --- a/src/main/kotlin/com/example/demo/services/database/city/CityServiceImpl.kt +++ b/src/main/kotlin/com/github/dannecron/demo/services/database/city/CityServiceImpl.kt @@ -1,10 +1,10 @@ -package com.example.demo.services.database.city +package com.github.dannecron.demo.services.database.city -import com.example.demo.models.City -import com.example.demo.providers.CityRepository -import com.example.demo.services.database.exceptions.CityNotFoundException -import com.example.demo.services.database.exceptions.AlreadyDeletedException -import com.example.demo.services.kafka.dto.CityCreateDto +import com.github.dannecron.demo.models.City +import com.github.dannecron.demo.providers.CityRepository +import com.github.dannecron.demo.services.database.exceptions.CityNotFoundException +import com.github.dannecron.demo.services.database.exceptions.AlreadyDeletedException +import com.github.dannecron.demo.services.kafka.dto.CityCreateDto import java.time.OffsetDateTime import java.time.format.DateTimeFormatter import java.util.* diff --git a/src/main/kotlin/com/github/dannecron/demo/services/database/customer/CustomerService.kt b/src/main/kotlin/com/github/dannecron/demo/services/database/customer/CustomerService.kt new file mode 100644 index 0000000..89c6e4a --- /dev/null +++ b/src/main/kotlin/com/github/dannecron/demo/services/database/customer/CustomerService.kt @@ -0,0 +1,13 @@ +package com.github.dannecron.demo.services.database.customer + +import com.github.dannecron.demo.models.Customer +import com.github.dannecron.demo.models.CustomerExtended +import com.github.dannecron.demo.services.database.exceptions.CityNotFoundException +import java.util.* + +interface CustomerService { + fun findByGuid(guid: UUID): CustomerExtended? + + @Throws(CityNotFoundException::class) + fun create(name: String, cityGuid: UUID?): Customer +} diff --git a/src/main/kotlin/com/example/demo/services/database/customer/CustomerServiceImpl.kt b/src/main/kotlin/com/github/dannecron/demo/services/database/customer/CustomerServiceImpl.kt similarity index 74% rename from src/main/kotlin/com/example/demo/services/database/customer/CustomerServiceImpl.kt rename to src/main/kotlin/com/github/dannecron/demo/services/database/customer/CustomerServiceImpl.kt index b913c4b..95b156a 100644 --- a/src/main/kotlin/com/example/demo/services/database/customer/CustomerServiceImpl.kt +++ b/src/main/kotlin/com/github/dannecron/demo/services/database/customer/CustomerServiceImpl.kt @@ -1,10 +1,10 @@ -package com.example.demo.services.database.customer +package com.github.dannecron.demo.services.database.customer -import com.example.demo.models.Customer -import com.example.demo.models.CustomerExtended -import com.example.demo.providers.CityRepository -import com.example.demo.providers.CustomerRepository -import com.example.demo.services.database.exceptions.CityNotFoundException +import com.github.dannecron.demo.models.Customer +import com.github.dannecron.demo.models.CustomerExtended +import com.github.dannecron.demo.providers.CityRepository +import com.github.dannecron.demo.providers.CustomerRepository +import com.github.dannecron.demo.services.database.exceptions.CityNotFoundException import java.time.OffsetDateTime import java.util.* diff --git a/src/main/kotlin/com/github/dannecron/demo/services/database/exceptions/AlreadyDeletedException.kt b/src/main/kotlin/com/github/dannecron/demo/services/database/exceptions/AlreadyDeletedException.kt new file mode 100644 index 0000000..0854a98 --- /dev/null +++ b/src/main/kotlin/com/github/dannecron/demo/services/database/exceptions/AlreadyDeletedException.kt @@ -0,0 +1,3 @@ +package com.github.dannecron.demo.services.database.exceptions + +class AlreadyDeletedException: RuntimeException() diff --git a/src/main/kotlin/com/github/dannecron/demo/services/database/exceptions/CityNotFoundException.kt b/src/main/kotlin/com/github/dannecron/demo/services/database/exceptions/CityNotFoundException.kt new file mode 100644 index 0000000..8205c75 --- /dev/null +++ b/src/main/kotlin/com/github/dannecron/demo/services/database/exceptions/CityNotFoundException.kt @@ -0,0 +1,3 @@ +package com.github.dannecron.demo.services.database.exceptions + +class CityNotFoundException: ModelNotFoundException("city") diff --git a/src/main/kotlin/com/example/demo/services/database/exceptions/ModelNotFoundException.kt b/src/main/kotlin/com/github/dannecron/demo/services/database/exceptions/ModelNotFoundException.kt similarity index 60% rename from src/main/kotlin/com/example/demo/services/database/exceptions/ModelNotFoundException.kt rename to src/main/kotlin/com/github/dannecron/demo/services/database/exceptions/ModelNotFoundException.kt index d357ee7..1d7f241 100644 --- a/src/main/kotlin/com/example/demo/services/database/exceptions/ModelNotFoundException.kt +++ b/src/main/kotlin/com/github/dannecron/demo/services/database/exceptions/ModelNotFoundException.kt @@ -1,3 +1,3 @@ -package com.example.demo.services.database.exceptions +package com.github.dannecron.demo.services.database.exceptions open class ModelNotFoundException(entityName: String): RuntimeException("$entityName not found") diff --git a/src/main/kotlin/com/example/demo/services/database/exceptions/ProductNotFoundException.kt b/src/main/kotlin/com/github/dannecron/demo/services/database/exceptions/ProductNotFoundException.kt similarity index 51% rename from src/main/kotlin/com/example/demo/services/database/exceptions/ProductNotFoundException.kt rename to src/main/kotlin/com/github/dannecron/demo/services/database/exceptions/ProductNotFoundException.kt index da0328c..3d68a6c 100644 --- a/src/main/kotlin/com/example/demo/services/database/exceptions/ProductNotFoundException.kt +++ b/src/main/kotlin/com/github/dannecron/demo/services/database/exceptions/ProductNotFoundException.kt @@ -1,3 +1,3 @@ -package com.example.demo.services.database.exceptions +package com.github.dannecron.demo.services.database.exceptions class ProductNotFoundException: ModelNotFoundException("product") diff --git a/src/main/kotlin/com/example/demo/services/database/product/ProductService.kt b/src/main/kotlin/com/github/dannecron/demo/services/database/product/ProductService.kt similarity index 62% rename from src/main/kotlin/com/example/demo/services/database/product/ProductService.kt rename to src/main/kotlin/com/github/dannecron/demo/services/database/product/ProductService.kt index dfd0e3c..15bcc1d 100644 --- a/src/main/kotlin/com/example/demo/services/database/product/ProductService.kt +++ b/src/main/kotlin/com/github/dannecron/demo/services/database/product/ProductService.kt @@ -1,9 +1,9 @@ -package com.example.demo.services.database.product +package com.github.dannecron.demo.services.database.product -import com.example.demo.models.Product -import com.example.demo.services.database.exceptions.AlreadyDeletedException -import com.example.demo.services.database.exceptions.ProductNotFoundException -import com.example.demo.services.kafka.exceptions.InvalidArgumentException +import com.github.dannecron.demo.models.Product +import com.github.dannecron.demo.services.database.exceptions.AlreadyDeletedException +import com.github.dannecron.demo.services.database.exceptions.ProductNotFoundException +import com.github.dannecron.demo.services.kafka.exceptions.InvalidArgumentException import org.springframework.data.domain.Page import org.springframework.data.domain.Pageable import org.springframework.stereotype.Service diff --git a/src/main/kotlin/com/example/demo/services/database/product/ProductServiceImpl.kt b/src/main/kotlin/com/github/dannecron/demo/services/database/product/ProductServiceImpl.kt similarity index 80% rename from src/main/kotlin/com/example/demo/services/database/product/ProductServiceImpl.kt rename to src/main/kotlin/com/github/dannecron/demo/services/database/product/ProductServiceImpl.kt index 0ec3aad..80dcffb 100644 --- a/src/main/kotlin/com/example/demo/services/database/product/ProductServiceImpl.kt +++ b/src/main/kotlin/com/github/dannecron/demo/services/database/product/ProductServiceImpl.kt @@ -1,11 +1,11 @@ -package com.example.demo.services.database.product +package com.github.dannecron.demo.services.database.product -import com.example.demo.models.Product -import com.example.demo.providers.ProductRepository -import com.example.demo.services.database.exceptions.AlreadyDeletedException -import com.example.demo.services.database.exceptions.ProductNotFoundException -import com.example.demo.services.kafka.Producer -import com.example.demo.utils.LoggerDelegate +import com.github.dannecron.demo.models.Product +import com.github.dannecron.demo.providers.ProductRepository +import com.github.dannecron.demo.services.database.exceptions.AlreadyDeletedException +import com.github.dannecron.demo.services.database.exceptions.ProductNotFoundException +import com.github.dannecron.demo.services.kafka.Producer +import com.github.dannecron.demo.utils.LoggerDelegate import net.logstash.logback.marker.Markers import org.springframework.data.domain.Page import org.springframework.data.domain.Pageable diff --git a/src/main/kotlin/com/example/demo/services/kafka/Consumer.kt b/src/main/kotlin/com/github/dannecron/demo/services/kafka/Consumer.kt similarity index 84% rename from src/main/kotlin/com/example/demo/services/kafka/Consumer.kt rename to src/main/kotlin/com/github/dannecron/demo/services/kafka/Consumer.kt index 83745e5..b4e93bd 100644 --- a/src/main/kotlin/com/example/demo/services/kafka/Consumer.kt +++ b/src/main/kotlin/com/github/dannecron/demo/services/kafka/Consumer.kt @@ -1,7 +1,7 @@ -package com.example.demo.services.kafka +package com.github.dannecron.demo.services.kafka -import com.example.demo.services.database.city.CityService -import com.example.demo.services.kafka.dto.CityCreateDto +import com.github.dannecron.demo.services.database.city.CityService +import com.github.dannecron.demo.services.kafka.dto.CityCreateDto import io.micrometer.core.instrument.Counter import io.micrometer.core.instrument.MeterRegistry import kotlinx.serialization.json.Json @@ -29,4 +29,4 @@ class Consumer( cityService.create(cityCreateDto) } -} \ No newline at end of file +} diff --git a/src/main/kotlin/com/github/dannecron/demo/services/kafka/Producer.kt b/src/main/kotlin/com/github/dannecron/demo/services/kafka/Producer.kt new file mode 100644 index 0000000..282d429 --- /dev/null +++ b/src/main/kotlin/com/github/dannecron/demo/services/kafka/Producer.kt @@ -0,0 +1,9 @@ +package com.github.dannecron.demo.services.kafka + +import com.github.dannecron.demo.models.Product +import com.github.dannecron.demo.services.kafka.exceptions.InvalidArgumentException + +interface Producer { + @Throws(InvalidArgumentException::class) + fun produceProductInfo(topicName: String, product: Product) +} diff --git a/src/main/kotlin/com/example/demo/services/kafka/ProducerImpl.kt b/src/main/kotlin/com/github/dannecron/demo/services/kafka/ProducerImpl.kt similarity index 75% rename from src/main/kotlin/com/example/demo/services/kafka/ProducerImpl.kt rename to src/main/kotlin/com/github/dannecron/demo/services/kafka/ProducerImpl.kt index c501cfb..1cfd932 100644 --- a/src/main/kotlin/com/example/demo/services/kafka/ProducerImpl.kt +++ b/src/main/kotlin/com/github/dannecron/demo/services/kafka/ProducerImpl.kt @@ -1,9 +1,9 @@ -package com.example.demo.services.kafka +package com.github.dannecron.demo.services.kafka -import com.example.demo.models.Product -import com.example.demo.services.kafka.dto.ProductDto -import com.example.demo.services.validation.SchemaValidator -import com.example.demo.services.validation.SchemaValidator.Companion.SCHEMA_KAFKA_PRODUCT_SYNC +import com.github.dannecron.demo.models.Product +import com.github.dannecron.demo.services.kafka.dto.ProductDto +import com.github.dannecron.demo.services.validation.SchemaValidator +import com.github.dannecron.demo.services.validation.SchemaValidator.Companion.SCHEMA_KAFKA_PRODUCT_SYNC import kotlinx.serialization.json.Json import kotlinx.serialization.json.encodeToJsonElement import org.springframework.kafka.core.KafkaTemplate @@ -31,4 +31,4 @@ class ProducerImpl( kafkaTemplate.send(message) } -} \ No newline at end of file +} diff --git a/src/main/kotlin/com/example/demo/services/kafka/dto/CityCreateDto.kt b/src/main/kotlin/com/github/dannecron/demo/services/kafka/dto/CityCreateDto.kt similarity index 80% rename from src/main/kotlin/com/example/demo/services/kafka/dto/CityCreateDto.kt rename to src/main/kotlin/com/github/dannecron/demo/services/kafka/dto/CityCreateDto.kt index 30da205..562d62d 100644 --- a/src/main/kotlin/com/example/demo/services/kafka/dto/CityCreateDto.kt +++ b/src/main/kotlin/com/github/dannecron/demo/services/kafka/dto/CityCreateDto.kt @@ -1,4 +1,4 @@ -package com.example.demo.services.kafka.dto +package com.github.dannecron.demo.services.kafka.dto import kotlinx.serialization.Serializable diff --git a/src/main/kotlin/com/example/demo/services/kafka/dto/ProductDto.kt b/src/main/kotlin/com/github/dannecron/demo/services/kafka/dto/ProductDto.kt similarity index 82% rename from src/main/kotlin/com/example/demo/services/kafka/dto/ProductDto.kt rename to src/main/kotlin/com/github/dannecron/demo/services/kafka/dto/ProductDto.kt index ff7a133..12c1cd4 100644 --- a/src/main/kotlin/com/example/demo/services/kafka/dto/ProductDto.kt +++ b/src/main/kotlin/com/github/dannecron/demo/services/kafka/dto/ProductDto.kt @@ -1,7 +1,7 @@ -package com.example.demo.services.kafka.dto +package com.github.dannecron.demo.services.kafka.dto -import com.example.demo.models.Product -import com.example.demo.services.kafka.exceptions.InvalidArgumentException +import com.github.dannecron.demo.models.Product +import com.github.dannecron.demo.services.kafka.exceptions.InvalidArgumentException import kotlinx.serialization.Serializable import java.time.format.DateTimeFormatter @@ -27,4 +27,4 @@ data class ProductDto( updatedAt = product.updatedAt?.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME), deletedAt = product.deletedAt?.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME), ) -} \ No newline at end of file +} diff --git a/src/main/kotlin/com/github/dannecron/demo/services/kafka/exceptions/InvalidArgumentException.kt b/src/main/kotlin/com/github/dannecron/demo/services/kafka/exceptions/InvalidArgumentException.kt new file mode 100644 index 0000000..a3072d5 --- /dev/null +++ b/src/main/kotlin/com/github/dannecron/demo/services/kafka/exceptions/InvalidArgumentException.kt @@ -0,0 +1,3 @@ +package com.github.dannecron.demo.services.kafka.exceptions + +class InvalidArgumentException(argName: String): RuntimeException("invalid argument $argName") diff --git a/src/main/kotlin/com/example/demo/services/serializables/OffsetDateTimeSerialization.kt b/src/main/kotlin/com/github/dannecron/demo/services/serializables/OffsetDateTimeSerialization.kt similarity index 92% rename from src/main/kotlin/com/example/demo/services/serializables/OffsetDateTimeSerialization.kt rename to src/main/kotlin/com/github/dannecron/demo/services/serializables/OffsetDateTimeSerialization.kt index 9838dbc..60da6d8 100644 --- a/src/main/kotlin/com/example/demo/services/serializables/OffsetDateTimeSerialization.kt +++ b/src/main/kotlin/com/github/dannecron/demo/services/serializables/OffsetDateTimeSerialization.kt @@ -1,4 +1,4 @@ -package com.example.demo.services.serializables +package com.github.dannecron.demo.services.serializables import kotlinx.serialization.KSerializer import kotlinx.serialization.descriptors.PrimitiveKind @@ -19,4 +19,4 @@ class OffsetDateTimeSerialization: KSerializer { encoder.encodeString(value.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME)) } -} \ No newline at end of file +} diff --git a/src/main/kotlin/com/example/demo/services/serializables/UuidSerialization.kt b/src/main/kotlin/com/github/dannecron/demo/services/serializables/UuidSerialization.kt similarity index 91% rename from src/main/kotlin/com/example/demo/services/serializables/UuidSerialization.kt rename to src/main/kotlin/com/github/dannecron/demo/services/serializables/UuidSerialization.kt index 99d7e07..d9386b5 100644 --- a/src/main/kotlin/com/example/demo/services/serializables/UuidSerialization.kt +++ b/src/main/kotlin/com/github/dannecron/demo/services/serializables/UuidSerialization.kt @@ -1,4 +1,4 @@ -package com.example.demo.services.serializables +package com.github.dannecron.demo.services.serializables import kotlinx.serialization.KSerializer import kotlinx.serialization.descriptors.PrimitiveKind @@ -18,4 +18,4 @@ class UuidSerialization: KSerializer { encoder.encodeString(value.toString()) } -} \ No newline at end of file +} diff --git a/src/main/kotlin/com/example/demo/services/validation/SchemaValidator.kt b/src/main/kotlin/com/github/dannecron/demo/services/validation/SchemaValidator.kt similarity index 56% rename from src/main/kotlin/com/example/demo/services/validation/SchemaValidator.kt rename to src/main/kotlin/com/github/dannecron/demo/services/validation/SchemaValidator.kt index e99e2fc..91f5b49 100644 --- a/src/main/kotlin/com/example/demo/services/validation/SchemaValidator.kt +++ b/src/main/kotlin/com/github/dannecron/demo/services/validation/SchemaValidator.kt @@ -1,7 +1,7 @@ -package com.example.demo.services.validation +package com.github.dannecron.demo.services.validation -import com.example.demo.services.validation.exceptions.ElementNotValidException -import com.example.demo.services.validation.exceptions.SchemaNotFoundException +import com.github.dannecron.demo.services.validation.exceptions.ElementNotValidException +import com.github.dannecron.demo.services.validation.exceptions.SchemaNotFoundException import kotlinx.serialization.json.JsonElement interface SchemaValidator { @@ -11,4 +11,4 @@ interface SchemaValidator { companion object { const val SCHEMA_KAFKA_PRODUCT_SYNC = "kafka-product-sync" } -} \ No newline at end of file +} diff --git a/src/main/kotlin/com/example/demo/services/validation/SchemaValidatorImp.kt b/src/main/kotlin/com/github/dannecron/demo/services/validation/SchemaValidatorImp.kt similarity index 83% rename from src/main/kotlin/com/example/demo/services/validation/SchemaValidatorImp.kt rename to src/main/kotlin/com/github/dannecron/demo/services/validation/SchemaValidatorImp.kt index 930be8b..38fc4ac 100644 --- a/src/main/kotlin/com/example/demo/services/validation/SchemaValidatorImp.kt +++ b/src/main/kotlin/com/github/dannecron/demo/services/validation/SchemaValidatorImp.kt @@ -1,7 +1,7 @@ -package com.example.demo.services.validation +package com.github.dannecron.demo.services.validation -import com.example.demo.services.validation.exceptions.ElementNotValidException -import com.example.demo.services.validation.exceptions.SchemaNotFoundException +import com.github.dannecron.demo.services.validation.exceptions.ElementNotValidException +import com.github.dannecron.demo.services.validation.exceptions.SchemaNotFoundException import io.github.optimumcode.json.schema.JsonSchema import io.github.optimumcode.json.schema.ValidationError import kotlinx.serialization.json.JsonElement @@ -41,4 +41,4 @@ class SchemaValidatorImp( return schema } -} \ No newline at end of file +} diff --git a/src/main/kotlin/com/example/demo/services/validation/exceptions/ElementNotValidException.kt b/src/main/kotlin/com/github/dannecron/demo/services/validation/exceptions/ElementNotValidException.kt similarity index 61% rename from src/main/kotlin/com/example/demo/services/validation/exceptions/ElementNotValidException.kt rename to src/main/kotlin/com/github/dannecron/demo/services/validation/exceptions/ElementNotValidException.kt index 94df391..e563994 100644 --- a/src/main/kotlin/com/example/demo/services/validation/exceptions/ElementNotValidException.kt +++ b/src/main/kotlin/com/github/dannecron/demo/services/validation/exceptions/ElementNotValidException.kt @@ -1,7 +1,7 @@ -package com.example.demo.services.validation.exceptions +package com.github.dannecron.demo.services.validation.exceptions import io.github.optimumcode.json.schema.ValidationError class ElementNotValidException( val validationErrors: List, -): RuntimeException() \ No newline at end of file +): RuntimeException() diff --git a/src/main/kotlin/com/github/dannecron/demo/services/validation/exceptions/SchemaNotFoundException.kt b/src/main/kotlin/com/github/dannecron/demo/services/validation/exceptions/SchemaNotFoundException.kt new file mode 100644 index 0000000..76f9fe7 --- /dev/null +++ b/src/main/kotlin/com/github/dannecron/demo/services/validation/exceptions/SchemaNotFoundException.kt @@ -0,0 +1,3 @@ +package com.github.dannecron.demo.services.validation.exceptions + +class SchemaNotFoundException: RuntimeException() diff --git a/src/main/kotlin/com/example/demo/utils/Extensions.kt b/src/main/kotlin/com/github/dannecron/demo/utils/Extensions.kt similarity index 84% rename from src/main/kotlin/com/example/demo/utils/Extensions.kt rename to src/main/kotlin/com/github/dannecron/demo/utils/Extensions.kt index c47ed7f..2daf840 100644 --- a/src/main/kotlin/com/example/demo/utils/Extensions.kt +++ b/src/main/kotlin/com/github/dannecron/demo/utils/Extensions.kt @@ -1,4 +1,4 @@ -package com.example.demo.utils +package com.github.dannecron.demo.utils import kotlin.math.pow import kotlin.math.roundToInt diff --git a/src/main/kotlin/com/example/demo/utils/Logger.kt b/src/main/kotlin/com/github/dannecron/demo/utils/Logger.kt similarity index 92% rename from src/main/kotlin/com/example/demo/utils/Logger.kt rename to src/main/kotlin/com/github/dannecron/demo/utils/Logger.kt index 8c0a0ac..5a0841e 100644 --- a/src/main/kotlin/com/example/demo/utils/Logger.kt +++ b/src/main/kotlin/com/github/dannecron/demo/utils/Logger.kt @@ -1,4 +1,4 @@ -package com.example.demo.utils +package com.github.dannecron.demo.utils import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -21,4 +21,4 @@ class LoggerDelegate : ReadOnlyProperty { } -fun getLogger(forClass: Class<*>): Logger = LoggerFactory.getLogger(forClass) \ No newline at end of file +fun getLogger(forClass: Class<*>): Logger = LoggerFactory.getLogger(forClass) diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 8608157..783741c 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,7 +1,7 @@ --- spring: application: - name: Demo + name: demo datasource: url: jdbc:postgresql://${DB_URL:localhost:5432}/${DB_NAME:demo}?currentSchema=${DB_SCHEMA:public} username: ${DB_USERNAME:postgres} diff --git a/src/test/kotlin/com/example/demo/BaseDbTest.kt b/src/test/kotlin/com/github/dannecron/demo/BaseDbTest.kt similarity index 87% rename from src/test/kotlin/com/example/demo/BaseDbTest.kt rename to src/test/kotlin/com/github/dannecron/demo/BaseDbTest.kt index 0673a09..49f3ce1 100644 --- a/src/test/kotlin/com/example/demo/BaseDbTest.kt +++ b/src/test/kotlin/com/github/dannecron/demo/BaseDbTest.kt @@ -1,6 +1,6 @@ -package com.example.demo +package com.github.dannecron.demo -import com.example.demo.services.kafka.Producer +import com.github.dannecron.demo.services.kafka.Producer import org.springframework.boot.test.autoconfigure.data.jdbc.DataJdbcTest import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase import org.springframework.boot.test.mock.mockito.MockBean @@ -16,4 +16,4 @@ import org.testcontainers.junit.jupiter.Testcontainers class BaseDbTest { @MockBean lateinit var producer: Producer -} \ No newline at end of file +} diff --git a/src/test/kotlin/com/example/demo/BaseUnitTest.kt b/src/test/kotlin/com/github/dannecron/demo/BaseUnitTest.kt similarity index 75% rename from src/test/kotlin/com/example/demo/BaseUnitTest.kt rename to src/test/kotlin/com/github/dannecron/demo/BaseUnitTest.kt index bb1451c..e4be7e2 100644 --- a/src/test/kotlin/com/example/demo/BaseUnitTest.kt +++ b/src/test/kotlin/com/github/dannecron/demo/BaseUnitTest.kt @@ -1,9 +1,9 @@ -package com.example.demo +package com.github.dannecron.demo -import com.example.demo.config.properties.KafkaProperties -import com.example.demo.config.properties.ValidationProperties -import com.example.demo.services.kafka.Consumer -import com.example.demo.services.validation.SchemaValidator.Companion.SCHEMA_KAFKA_PRODUCT_SYNC +import com.github.dannecron.demo.config.properties.KafkaProperties +import com.github.dannecron.demo.config.properties.ValidationProperties +import com.github.dannecron.demo.services.kafka.Consumer +import com.github.dannecron.demo.services.validation.SchemaValidator.Companion.SCHEMA_KAFKA_PRODUCT_SYNC import org.springframework.boot.test.context.TestConfiguration import org.springframework.boot.test.mock.mockito.MockBean import org.springframework.context.annotation.Bean @@ -35,4 +35,4 @@ open class BaseUnitTest { schema = mapOf(SCHEMA_KAFKA_PRODUCT_SYNC to "kafka/product/sync.json"), ) } -} \ No newline at end of file +} diff --git a/src/test/kotlin/com/example/demo/http/controllers/CustomerControllerTest.kt b/src/test/kotlin/com/github/dannecron/demo/http/controllers/CustomerControllerTest.kt similarity index 90% rename from src/test/kotlin/com/example/demo/http/controllers/CustomerControllerTest.kt rename to src/test/kotlin/com/github/dannecron/demo/http/controllers/CustomerControllerTest.kt index ae18fac..1ad05c2 100644 --- a/src/test/kotlin/com/example/demo/http/controllers/CustomerControllerTest.kt +++ b/src/test/kotlin/com/github/dannecron/demo/http/controllers/CustomerControllerTest.kt @@ -1,11 +1,11 @@ -package com.example.demo.http.controllers +package com.github.dannecron.demo.http.controllers -import com.example.demo.BaseUnitTest -import com.example.demo.http.responses.ResponseStatus -import com.example.demo.models.City -import com.example.demo.models.Customer -import com.example.demo.models.CustomerExtended -import com.example.demo.services.database.customer.CustomerService +import com.github.dannecron.demo.BaseUnitTest +import com.github.dannecron.demo.http.responses.ResponseStatus +import com.github.dannecron.demo.models.City +import com.github.dannecron.demo.models.Customer +import com.github.dannecron.demo.models.CustomerExtended +import com.github.dannecron.demo.services.database.customer.CustomerService import org.mockito.kotlin.doReturn import org.mockito.kotlin.eq import org.mockito.kotlin.whenever diff --git a/src/test/kotlin/com/example/demo/http/controllers/GreetingControllerTest.kt b/src/test/kotlin/com/github/dannecron/demo/http/controllers/GreetingControllerTest.kt similarity index 84% rename from src/test/kotlin/com/example/demo/http/controllers/GreetingControllerTest.kt rename to src/test/kotlin/com/github/dannecron/demo/http/controllers/GreetingControllerTest.kt index 9d62d97..2bb93fa 100644 --- a/src/test/kotlin/com/example/demo/http/controllers/GreetingControllerTest.kt +++ b/src/test/kotlin/com/github/dannecron/demo/http/controllers/GreetingControllerTest.kt @@ -1,6 +1,6 @@ -package com.example.demo.http.controllers +package com.github.dannecron.demo.http.controllers -import com.example.demo.BaseUnitTest +import com.github.dannecron.demo.BaseUnitTest import org.hamcrest.core.StringContains import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest @@ -8,7 +8,7 @@ import org.springframework.test.web.servlet.MockMvc import org.springframework.test.web.servlet.get import kotlin.test.Test -@WebMvcTest(GreetingController::class) +@WebMvcTest(com.github.dannecron.demo.http.controllers.GreetingController::class) class GreetingControllerTest(@Autowired val mockMvc: MockMvc): BaseUnitTest() { @Test fun greetings_shouldSeeGreetingMessage() { diff --git a/src/test/kotlin/com/example/demo/http/controllers/ProductControllerTest.kt b/src/test/kotlin/com/github/dannecron/demo/http/controllers/ProductControllerTest.kt similarity index 96% rename from src/test/kotlin/com/example/demo/http/controllers/ProductControllerTest.kt rename to src/test/kotlin/com/github/dannecron/demo/http/controllers/ProductControllerTest.kt index 81953a6..4a5ee03 100644 --- a/src/test/kotlin/com/example/demo/http/controllers/ProductControllerTest.kt +++ b/src/test/kotlin/com/github/dannecron/demo/http/controllers/ProductControllerTest.kt @@ -1,9 +1,9 @@ -package com.example.demo.http.controllers +package com.github.dannecron.demo.http.controllers -import com.example.demo.BaseUnitTest -import com.example.demo.http.responses.ResponseStatus -import com.example.demo.models.Product -import com.example.demo.services.database.product.ProductService +import com.github.dannecron.demo.BaseUnitTest +import com.github.dannecron.demo.http.responses.ResponseStatus +import com.github.dannecron.demo.models.Product +import com.github.dannecron.demo.services.database.product.ProductService import org.hamcrest.Matchers.contains import org.hamcrest.Matchers.nullValue import org.junit.jupiter.api.Test diff --git a/src/test/kotlin/com/example/demo/http/controllers/ShopControllerTest.kt b/src/test/kotlin/com/github/dannecron/demo/http/controllers/ShopControllerTest.kt similarity index 94% rename from src/test/kotlin/com/example/demo/http/controllers/ShopControllerTest.kt rename to src/test/kotlin/com/github/dannecron/demo/http/controllers/ShopControllerTest.kt index 55f3a51..05d1ad8 100644 --- a/src/test/kotlin/com/example/demo/http/controllers/ShopControllerTest.kt +++ b/src/test/kotlin/com/github/dannecron/demo/http/controllers/ShopControllerTest.kt @@ -1,8 +1,8 @@ -package com.example.demo.http.controllers +package com.github.dannecron.demo.http.controllers -import com.example.demo.BaseUnitTest -import com.example.demo.models.* -import com.example.demo.providers.ShopProvider +import com.github.dannecron.demo.BaseUnitTest +import com.github.dannecron.demo.models.* +import com.github.dannecron.demo.providers.ShopProvider import org.mockito.kotlin.doReturn import org.mockito.kotlin.whenever import org.springframework.beans.factory.annotation.Autowired diff --git a/src/test/kotlin/com/example/demo/services/database/city/CityServiceImplDbTest.kt b/src/test/kotlin/com/github/dannecron/demo/services/database/city/CityServiceImplDbTest.kt similarity index 80% rename from src/test/kotlin/com/example/demo/services/database/city/CityServiceImplDbTest.kt rename to src/test/kotlin/com/github/dannecron/demo/services/database/city/CityServiceImplDbTest.kt index 53e8ff1..64c51b4 100644 --- a/src/test/kotlin/com/example/demo/services/database/city/CityServiceImplDbTest.kt +++ b/src/test/kotlin/com/github/dannecron/demo/services/database/city/CityServiceImplDbTest.kt @@ -1,10 +1,10 @@ -package com.example.demo.services.database.city +package com.github.dannecron.demo.services.database.city -import com.example.demo.BaseDbTest -import com.example.demo.models.City -import com.example.demo.providers.CityRepository -import com.example.demo.services.database.exceptions.AlreadyDeletedException -import com.example.demo.services.database.exceptions.CityNotFoundException +import com.github.dannecron.demo.BaseDbTest +import com.github.dannecron.demo.models.City +import com.github.dannecron.demo.providers.CityRepository +import com.github.dannecron.demo.services.database.exceptions.AlreadyDeletedException +import com.github.dannecron.demo.services.database.exceptions.CityNotFoundException import org.junit.jupiter.api.assertThrows import org.springframework.beans.factory.annotation.Autowired import org.springframework.test.context.ContextConfiguration diff --git a/src/test/kotlin/com/example/demo/services/database/customer/CustomerServiceImplDbTest.kt b/src/test/kotlin/com/github/dannecron/demo/services/database/customer/CustomerServiceImplDbTest.kt similarity index 87% rename from src/test/kotlin/com/example/demo/services/database/customer/CustomerServiceImplDbTest.kt rename to src/test/kotlin/com/github/dannecron/demo/services/database/customer/CustomerServiceImplDbTest.kt index b77d951..61aa36e 100644 --- a/src/test/kotlin/com/example/demo/services/database/customer/CustomerServiceImplDbTest.kt +++ b/src/test/kotlin/com/github/dannecron/demo/services/database/customer/CustomerServiceImplDbTest.kt @@ -1,10 +1,10 @@ -package com.example.demo.services.database.customer +package com.github.dannecron.demo.services.database.customer -import com.example.demo.BaseDbTest -import com.example.demo.models.City -import com.example.demo.providers.CityRepository -import com.example.demo.providers.CustomerRepository -import com.example.demo.services.database.exceptions.CityNotFoundException +import com.github.dannecron.demo.BaseDbTest +import com.github.dannecron.demo.models.City +import com.github.dannecron.demo.providers.CityRepository +import com.github.dannecron.demo.providers.CustomerRepository +import com.github.dannecron.demo.services.database.exceptions.CityNotFoundException import org.junit.jupiter.api.assertThrows import org.springframework.beans.factory.annotation.Autowired import org.springframework.test.context.ContextConfiguration diff --git a/src/test/kotlin/com/example/demo/services/database/product/ProductServiceImplDbTest.kt b/src/test/kotlin/com/github/dannecron/demo/services/database/product/ProductServiceImplDbTest.kt similarity index 84% rename from src/test/kotlin/com/example/demo/services/database/product/ProductServiceImplDbTest.kt rename to src/test/kotlin/com/github/dannecron/demo/services/database/product/ProductServiceImplDbTest.kt index 3b920a0..eed0ffc 100644 --- a/src/test/kotlin/com/example/demo/services/database/product/ProductServiceImplDbTest.kt +++ b/src/test/kotlin/com/github/dannecron/demo/services/database/product/ProductServiceImplDbTest.kt @@ -1,10 +1,10 @@ -package com.example.demo.services.database.product +package com.github.dannecron.demo.services.database.product -import com.example.demo.BaseDbTest -import com.example.demo.models.Product -import com.example.demo.providers.ProductRepository -import com.example.demo.services.database.exceptions.AlreadyDeletedException -import com.example.demo.services.database.exceptions.ProductNotFoundException +import com.github.dannecron.demo.BaseDbTest +import com.github.dannecron.demo.models.Product +import com.github.dannecron.demo.providers.ProductRepository +import com.github.dannecron.demo.services.database.exceptions.AlreadyDeletedException +import com.github.dannecron.demo.services.database.exceptions.ProductNotFoundException import org.junit.jupiter.api.assertThrows import org.springframework.beans.factory.annotation.Autowired import org.springframework.test.context.ContextConfiguration diff --git a/src/test/kotlin/com/example/demo/services/database/product/ProductServiceImplTest.kt b/src/test/kotlin/com/github/dannecron/demo/services/database/product/ProductServiceImplTest.kt similarity index 86% rename from src/test/kotlin/com/example/demo/services/database/product/ProductServiceImplTest.kt rename to src/test/kotlin/com/github/dannecron/demo/services/database/product/ProductServiceImplTest.kt index a923084..320f733 100644 --- a/src/test/kotlin/com/example/demo/services/database/product/ProductServiceImplTest.kt +++ b/src/test/kotlin/com/github/dannecron/demo/services/database/product/ProductServiceImplTest.kt @@ -1,11 +1,11 @@ -package com.example.demo.services.database.product +package com.github.dannecron.demo.services.database.product -import com.example.demo.BaseUnitTest -import com.example.demo.models.Product -import com.example.demo.providers.ProductRepository -import com.example.demo.services.database.exceptions.ProductNotFoundException -import com.example.demo.services.kafka.Producer -import com.example.demo.services.kafka.exceptions.InvalidArgumentException +import com.github.dannecron.demo.BaseUnitTest +import com.github.dannecron.demo.models.Product +import com.github.dannecron.demo.providers.ProductRepository +import com.github.dannecron.demo.services.database.exceptions.ProductNotFoundException +import com.github.dannecron.demo.services.kafka.Producer +import com.github.dannecron.demo.services.kafka.exceptions.InvalidArgumentException import org.junit.jupiter.api.assertThrows import org.junit.runner.RunWith import org.mockito.kotlin.* diff --git a/src/test/kotlin/com/example/demo/services/kafka/ConsumerKfkTest.kt b/src/test/kotlin/com/github/dannecron/demo/services/kafka/ConsumerKfkTest.kt similarity index 91% rename from src/test/kotlin/com/example/demo/services/kafka/ConsumerKfkTest.kt rename to src/test/kotlin/com/github/dannecron/demo/services/kafka/ConsumerKfkTest.kt index 6b8e9d8..eb2b4e8 100644 --- a/src/test/kotlin/com/example/demo/services/kafka/ConsumerKfkTest.kt +++ b/src/test/kotlin/com/github/dannecron/demo/services/kafka/ConsumerKfkTest.kt @@ -1,8 +1,8 @@ -package com.example.demo.services.kafka +package com.github.dannecron.demo.services.kafka -import com.example.demo.models.City -import com.example.demo.services.database.city.CityService -import com.example.demo.services.kafka.dto.CityCreateDto +import com.github.dannecron.demo.models.City +import com.github.dannecron.demo.services.database.city.CityService +import com.github.dannecron.demo.services.kafka.dto.CityCreateDto import io.micrometer.core.instrument.MeterRegistry import kotlinx.serialization.encodeToString import kotlinx.serialization.json.Json @@ -76,4 +76,4 @@ class ConsumerKfkTest( assertEquals(1.0, metricRegistry.get("kafka_consumer_city_create").counter().count()) } -} \ No newline at end of file +} diff --git a/src/test/kotlin/com/example/demo/services/kafka/ProducerImplTest.kt b/src/test/kotlin/com/github/dannecron/demo/services/kafka/ProducerImplTest.kt similarity index 89% rename from src/test/kotlin/com/example/demo/services/kafka/ProducerImplTest.kt rename to src/test/kotlin/com/github/dannecron/demo/services/kafka/ProducerImplTest.kt index 1258823..8c7bbd0 100644 --- a/src/test/kotlin/com/example/demo/services/kafka/ProducerImplTest.kt +++ b/src/test/kotlin/com/github/dannecron/demo/services/kafka/ProducerImplTest.kt @@ -1,9 +1,9 @@ -package com.example.demo.services.kafka +package com.github.dannecron.demo.services.kafka -import com.example.demo.BaseUnitTest -import com.example.demo.models.Product -import com.example.demo.services.kafka.dto.ProductDto -import com.example.demo.services.validation.SchemaValidator +import com.github.dannecron.demo.BaseUnitTest +import com.github.dannecron.demo.models.Product +import com.github.dannecron.demo.services.kafka.dto.ProductDto +import com.github.dannecron.demo.services.validation.SchemaValidator import kotlinx.serialization.json.Json import kotlinx.serialization.json.encodeToJsonElement import org.junit.runner.RunWith @@ -68,4 +68,4 @@ class ProducerImplTest: BaseUnitTest() { assertEquals(topic, actualArgument.headers[KafkaHeaders.TOPIC]) assertEquals("some-custom-header", actualArgument.headers["X-Custom-Header"]) } -} \ No newline at end of file +} diff --git a/src/test/kotlin/com/example/demo/services/validation/SchemaValidatorImpTest.kt b/src/test/kotlin/com/github/dannecron/demo/services/validation/SchemaValidatorImpTest.kt similarity index 89% rename from src/test/kotlin/com/example/demo/services/validation/SchemaValidatorImpTest.kt rename to src/test/kotlin/com/github/dannecron/demo/services/validation/SchemaValidatorImpTest.kt index 8410169..bafdc63 100644 --- a/src/test/kotlin/com/example/demo/services/validation/SchemaValidatorImpTest.kt +++ b/src/test/kotlin/com/github/dannecron/demo/services/validation/SchemaValidatorImpTest.kt @@ -1,9 +1,9 @@ -package com.example.demo.services.validation +package com.github.dannecron.demo.services.validation -import com.example.demo.BaseUnitTest -import com.example.demo.services.validation.SchemaValidator.Companion.SCHEMA_KAFKA_PRODUCT_SYNC -import com.example.demo.services.validation.exceptions.ElementNotValidException -import com.example.demo.services.validation.exceptions.SchemaNotFoundException +import com.github.dannecron.demo.BaseUnitTest +import com.github.dannecron.demo.services.validation.SchemaValidator.Companion.SCHEMA_KAFKA_PRODUCT_SYNC +import com.github.dannecron.demo.services.validation.exceptions.ElementNotValidException +import com.github.dannecron.demo.services.validation.exceptions.SchemaNotFoundException import kotlinx.serialization.json.Json import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.Arguments @@ -95,4 +95,4 @@ class SchemaValidatorImpTest( ) ) } -} \ No newline at end of file +}