Full Code of phauer/blog-related for AI

master 8a63126e0845 cached
363 files
505.3 KB
140.9k tokens
589 symbols
1 requests
Download .txt
Showing preview only (614K chars total). Download the full file or copy to clipboard to get everything.
Repository: phauer/blog-related
Branch: master
Commit: 8a63126e0845
Files: 363
Total size: 505.3 KB

Directory structure:
gitextract_2r1gvc7i/

├── README.md
├── cairosvg-on-alpine/
│   ├── .gitignore
│   ├── Pipfile
│   ├── README.md
│   ├── docker-compose.yml
│   └── src/
│       ├── Dockerfile
│       └── svg-converter-service.py
├── cleaner-code-with-kotlin/
│   ├── .gitignore
│   ├── pom.xml
│   └── src/
│       └── main/
│           └── kotlin/
│               └── functions/
│                   ├── BeAware.kt
│                   ├── Expressions.kt
│                   ├── Immutability.kt
│                   ├── Nullability.kt
│                   ├── ProductClient.java
│                   └── ProductClientKotlin.kt
├── compare-payloads/
│   ├── .gitignore
│   ├── README.md
│   ├── compare-scripts/
│   │   ├── compare-all-final.sh
│   │   ├── compare-by-sorting.sh
│   │   ├── compare-json-payload.sh
│   │   └── compare-xml-payload.sh
│   ├── pom.xml
│   └── src/
│       └── main/
│           ├── java/
│           │   └── de/
│           │       └── philipphauer/
│           │           └── blog/
│           │               ├── BlogPost.java
│           │               ├── BlogPost2.java
│           │               └── ComparePayloadApplication.java
│           └── resources/
│               └── application.properties
├── continuation-token/
│   ├── .gitignore
│   ├── README.md
│   ├── continuation-token/
│   │   ├── .gitignore
│   │   ├── .mvn/
│   │   │   └── wrapper/
│   │   │       ├── maven-wrapper.jar
│   │   │       └── maven-wrapper.properties
│   │   ├── mvnw
│   │   ├── mvnw.cmd
│   │   ├── pom.xml
│   │   └── src/
│   │       ├── main/
│   │       │   └── kotlin/
│   │       │       └── de/
│   │       │           └── philipphauer/
│   │       │               └── blog/
│   │       │                   └── pagination/
│   │       │                       ├── ContinuationTokenParser.kt
│   │       │                       ├── Model.kt
│   │       │                       └── Pagination.kt
│   │       └── test/
│   │           └── kotlin/
│   │               └── de/
│   │                   └── philipphauer/
│   │                       └── blog/
│   │                           └── pagination/
│   │                               ├── ContinuationTokenParserTest.kt
│   │                               └── PaginationTest.kt
│   └── demo-kotlin/
│       ├── .gitignore
│       ├── .mvn/
│       │   └── wrapper/
│       │       ├── maven-wrapper.jar
│       │       └── maven-wrapper.properties
│       ├── mvnw
│       ├── mvnw.cmd
│       ├── pom.xml
│       └── src/
│           ├── main/
│           │   ├── kotlin/
│           │   │   └── de/
│           │   │       └── philipphauer/
│           │   │           └── blog/
│           │   │               ├── DesignDAO.kt
│           │   │               ├── DesignEntity.kt
│           │   │               ├── DesignResource.kt
│           │   │               ├── Main.kt
│           │   │               └── util/
│           │   │                   ├── DesignCreator.kt
│           │   │                   └── FunctionsMySQL.kt
│           │   └── resources/
│           │       └── create-designs-table.sql
│           └── test/
│               └── kotlin/
│                   └── de/
│                       └── philipphauer/
│                           └── blog/
│                               └── DesignResourceTest.kt
├── development-productivity-vaadin-spring-boot/
│   ├── .gitignore
│   ├── .mvn/
│   │   └── wrapper/
│   │       ├── maven-wrapper.jar
│   │       └── maven-wrapper.properties
│   ├── Makefile
│   ├── README.md
│   ├── mvnw
│   ├── mvnw.cmd
│   ├── pom.xml
│   ├── springloaded-1.2.9.BUILD-20170831.190856-1.jar
│   └── src/
│       └── main/
│           ├── java/
│           │   └── de/
│           │       └── philipphauer/
│           │           └── blog/
│           │               └── devproductivity/
│           │                   ├── DevProductivityApplication.java
│           │                   ├── WebSecurityConfiguration.java
│           │                   ├── model/
│           │                   │   ├── Role.java
│           │                   │   └── User.java
│           │                   ├── rest/
│           │                   │   └── AdminResource.java
│           │                   └── ui/
│           │                       └── MyAppUI.java
│           ├── resources/
│           │   └── application.properties
│           └── webapp/
│               └── VAADIN/
│                   └── themes/
│                       └── mytheme/
│                           ├── addons.scss
│                           ├── mytheme.scss
│                           └── styles.scss
├── dont-use-in-memory-databases-tests/
│   ├── db-container-managed-by-gradle/
│   │   ├── .gitignore
│   │   ├── build.gradle
│   │   ├── docker-compose.yml
│   │   ├── gradle/
│   │   │   └── wrapper/
│   │   │       ├── gradle-wrapper.jar
│   │   │       └── gradle-wrapper.properties
│   │   ├── gradlew
│   │   ├── gradlew.bat
│   │   ├── settings.gradle
│   │   └── src/
│   │       └── test/
│   │           └── java/
│   │               └── de/
│   │                   └── philipphauer/
│   │                       └── blog/
│   │                           └── MyTest.java
│   ├── db-container-managed-by-maven/
│   │   ├── .gitignore
│   │   ├── docker-compose.yml
│   │   ├── pom.xml
│   │   └── src/
│   │       └── test/
│   │           └── java/
│   │               └── de/
│   │                   └── philipphauer/
│   │                       └── blog/
│   │                           └── MyIT.java
│   └── db-container-managed-by-the-test/
│       ├── .gitignore
│       ├── build.gradle
│       ├── docker-compose.yml
│       ├── gradle/
│       │   └── wrapper/
│       │       ├── gradle-wrapper.jar
│       │       └── gradle-wrapper.properties
│       ├── gradlew
│       ├── gradlew.bat
│       ├── settings.gradle
│       └── src/
│           └── test/
│               └── java/
│                   └── de/
│                       └── philipphauer/
│                           └── blog/
│                               └── MyTest.java
├── framework-beats-generator/
│   ├── .gitignore
│   ├── pom.xml
│   ├── src/
│   │   ├── main/
│   │   │   ├── java/
│   │   │   │   └── de/
│   │   │   │       └── philipphauer/
│   │   │   │           ├── h2/
│   │   │   │           │   └── H2WebConsole.java
│   │   │   │           ├── jpa/
│   │   │   │           │   ├── Article.java
│   │   │   │           │   └── ArticleDAO.java
│   │   │   │           └── mongojack/
│   │   │   │               ├── Product.java
│   │   │   │               └── ProductDAO.java
│   │   │   └── resources/
│   │   │       └── META-INF/
│   │   │           └── persistence.xml
│   │   └── test/
│   │       └── java/
│   │           └── de/
│   │               └── philipphauer/
│   │                   ├── jpa/
│   │                   │   ├── ArticleDAOTest.java
│   │                   │   └── H2Test.java
│   │                   └── mongojack/
│   │                       └── ProductDAOTest.java
│   └── startMongoDBLocally.bat
├── kotlin-examples/
│   ├── .gitignore
│   ├── pom.xml
│   └── src/
│       └── main/
│           └── java/
│               ├── javaVariant/
│               │   ├── 1DefineAndMapBeans.java
│               │   └── 2ConditionsAndTypeSwitch.java
│               └── kotlinVariant/
│                   ├── 1DefineAndMapBeans.kt
│                   └── 2ConditionsAndTypeSwitch.kt
├── kotlin-idiomatic/
│   ├── .gitignore
│   ├── pom.xml
│   └── src/
│       └── main/
│           └── kotlin/
│               └── idiomaticKotlin/
│                   ├── Apply.kt
│                   ├── DefaultArgs.kt
│                   ├── Destruction.kt
│                   ├── FunctionalProgramming.kt
│                   ├── InitBlock.kt
│                   ├── Mapping.kt
│                   ├── NamedArgs.kt
│                   ├── Nullability.kt
│                   ├── ObjectForStatelessFWImpls.kt
│                   ├── Structs.kt
│                   ├── TopLevelExtensionFunctions.kt
│                   └── ValueObjects.kt
├── kotlin-spring-boot-vaadin-scaffolding/
│   ├── .gitignore
│   ├── README.md
│   ├── TODO.md
│   ├── docker-compose.yml
│   ├── myapp.yaml
│   ├── pom.xml
│   └── src/
│       ├── main/
│       │   ├── kotlin/
│       │   │   └── de/
│       │   │       └── philipphauer/
│       │   │           └── blog/
│       │   │               ├── misc/
│       │   │               │   ├── PuttingTogether.kt
│       │   │               │   ├── ValueObjects.kt
│       │   │               │   ├── constructorinjection/
│       │   │               │   │   ├── CRMClient.java
│       │   │               │   │   ├── ConstructorInjection.kt
│       │   │               │   │   ├── CustomerRepository.java
│       │   │               │   │   └── CustomerResource.java
│       │   │               │   └── vaadin/
│       │   │               │       ├── ActionListenerLambdaExample.kt
│       │   │               │       └── ActionListenerLambdaExampleJava.java
│       │   │               └── scaffolding/
│       │   │                   ├── DummyDataCreator.kt
│       │   │                   ├── MyApplication.kt
│       │   │                   ├── SpringConfiguration.kt
│       │   │                   ├── YamlConfigProps.kt
│       │   │                   ├── db/
│       │   │                   │   ├── Entities.kt
│       │   │                   │   └── SnippetRepository.kt
│       │   │                   ├── rest/
│       │   │                   │   └── AdminResource.kt
│       │   │                   └── ui/
│       │   │                       ├── Beans.kt
│       │   │                       ├── DetailsWindow.kt
│       │   │                       ├── EntityToBeanMapper.kt
│       │   │                       ├── MainViewDisplay.kt
│       │   │                       ├── MyAppUI.kt
│       │   │                       ├── NavigationPresenter.kt
│       │   │                       ├── UiMisc.kt
│       │   │                       └── views/
│       │   │                           ├── CreateSnippetView.kt
│       │   │                           ├── ErrorView.kt
│       │   │                           └── OverviewView.kt
│       │   └── resources/
│       │       ├── VAADIN/
│       │       │   └── themes/
│       │       │       └── mytheme/
│       │       │           ├── mytheme.scss
│       │       │           └── styles.scss
│       │       ├── application.properties
│       │       └── banner.txt
│       └── test/
│           └── kotlin/
│               └── de/
│                   └── philipphauer/
│                       └── blog/
│                           └── scaffolding/
│                               └── DummyDataCreatorTest.kt
├── modern-best-practices-testing-java/
│   ├── .gitignore
│   ├── docker-compose.yml
│   ├── pom.xml
│   └── src/
│       ├── main/
│       │   ├── java/
│       │   │   └── com/
│       │   │       └── phauer/
│       │   │           └── modernunittesting/
│       │   │               ├── FuturePlayground.java
│       │   │               ├── MainLayout.java
│       │   │               ├── ModernUnitTestingApplication.java
│       │   │               ├── PriceCalculator.java
│       │   │               ├── ProductController.java
│       │   │               ├── ProductDAO.java
│       │   │               ├── ProductDTO.java
│       │   │               ├── ProductEntity.java
│       │   │               ├── ProductModel.java
│       │   │               ├── ProductView.java
│       │   │               ├── SchemaCreator.java
│       │   │               ├── TaxServiceClient.java
│       │   │               └── TaxServiceResponseDTO.java
│       │   └── resources/
│       │       └── application.properties
│       └── test/
│           └── java/
│               └── com/
│                   └── phauer/
│                       └── modernunittesting/
│                           ├── AssertJTest.java
│                           ├── AwaitilityTest.java
│                           ├── DesignControllerTest.java
│                           ├── DisplayNameTest.java
│                           ├── HelperFunctions.java
│                           ├── ParameterTest.java
│                           ├── Product.java
│                           ├── ProductControllerITest.java
│                           ├── ProductControllerITest2.java
│                           ├── ProductViewITest.java
│                           └── RandomizedValues.java
├── modern-integration-testing/
│   ├── .gitignore
│   ├── docker-compose.yml
│   ├── pom.xml
│   └── src/
│       ├── main/
│       │   ├── java/
│       │   │   └── com/
│       │   │       └── phauer/
│       │   │           └── modernunittesting/
│       │   │               ├── MainLayout.java
│       │   │               ├── ModernUnitTestingApplication.java
│       │   │               ├── PriceCalculator.java
│       │   │               ├── ProductController.java
│       │   │               ├── ProductDAO.java
│       │   │               ├── ProductDTO.java
│       │   │               ├── ProductEntity.java
│       │   │               ├── ProductModel.java
│       │   │               ├── ProductView.java
│       │   │               ├── SchemaCreator.java
│       │   │               ├── TaxServiceClient.java
│       │   │               └── TaxServiceResponseDTO.java
│       │   └── resources/
│       │       └── application.properties
│       └── test/
│           └── java/
│               └── com/
│                   └── phauer/
│                       └── modernunittesting/
│                           ├── AssertJTest.java
│                           ├── Product.java
│                           ├── ProductControllerITest.java
│                           ├── ProductControllerITest2.java
│                           └── ProductViewITest.java
├── mongodb-practice/
│   ├── connection-strings.sh
│   ├── docker-compose.yml
│   ├── example.json
│   └── local-dev/
│       └── mongo-seeding/
│           ├── Dockerfile
│           └── seedMongo.py
├── python-demo/
│   ├── .gitignore
│   ├── 1concise-powerful.py
│   ├── 2collections.py
│   ├── 3functions.py
│   ├── 4classes.py
│   └── 5operator-overloading.py
├── rest-api-doc-jaxrs-swagger-asciidoc/
│   ├── .gitignore
│   ├── README.md
│   ├── config.yml
│   ├── generate-documentation.sh
│   ├── pom.xml
│   ├── src/
│   │   ├── docs/
│   │   │   └── asciidoc/
│   │   │       ├── custom.css
│   │   │       ├── general-remarks.adoc
│   │   │       ├── index.adoc
│   │   │       └── usage.adoc
│   │   └── main/
│   │       ├── java/
│   │       │   └── de/
│   │       │       └── philipphauer/
│   │       │           └── blog/
│   │       │               ├── RestApiDocApplication.java
│   │       │               ├── RestApiDocConfiguration.java
│   │       │               ├── apiDocGen/
│   │       │               │   └── SwaggerAndAsciiDocGenerator.java
│   │       │               └── resources/
│   │       │                   ├── BandResource.java
│   │       │                   ├── CORSFilter.java
│   │       │                   ├── DocumentationResource.java
│   │       │                   └── dto/
│   │       │                       ├── BandCreationDTO.java
│   │       │                       └── BandRetrievalDTO.java
│   │       └── resources/
│   │           └── banner.txt
│   └── swagger-ui/
│       └── docker-compose.yml
├── sealedclasses/
│   ├── .gitignore
│   ├── docker-compose.yml
│   ├── pom.xml
│   ├── service-stub/
│   │   ├── Dockerfile
│   │   └── service-stub.py
│   └── src/
│       ├── main/
│       │   └── kotlin/
│       │       └── com/
│       │           └── phauer/
│       │               ├── HttpUserProfileClient.kt
│       │               ├── ImageAvailabilityClient.kt
│       │               ├── LdapDAO.kt
│       │               └── common/
│       │                   └── Common.kt
│       └── test/
│           └── kotlin/
│               └── com/
│                   └── phauer/
│                       └── HelloTest.kt
├── smooth-local-dev-docker/
│   ├── .gitignore
│   ├── Pipfile
│   ├── bla.conf
│   ├── docker-compose.yml
│   ├── local-dev/
│   │   ├── external-service-stub/
│   │   │   ├── Dockerfile
│   │   │   ├── Pipfile
│   │   │   ├── external-service-stub.py
│   │   │   └── static-user-response.json
│   │   ├── external-service-wrapped/
│   │   │   ├── Dockerfile
│   │   │   └── config.yaml
│   │   ├── mongo-seeding/
│   │   │   ├── Dockerfile
│   │   │   ├── Pipfile
│   │   │   └── seed-mongo.py
│   │   └── mysql-seeding/
│   │       ├── Dockerfile
│   │       ├── Pipfile
│   │       └── seed-mysql.py
│   ├── pom.xml
│   └── src/
│       ├── main/
│       │   └── kotlin/
│       │       └── de/
│       │           └── philipphauer/
│       │               └── blog/
│       │                   ├── ExternalServiceUserClient.kt
│       │                   ├── Main.kt
│       │                   ├── MongoDesignDAO.kt
│       │                   └── MySqlUserDAO.kt
│       └── test/
│           └── kotlin/
│               └── de/
│                   └── philipphauer/
│                       └── blog/
│                           └── HelloTest.kt
├── testingrestservice/
│   ├── integration-tests/
│   │   ├── .gitignore
│   │   ├── pom.xml
│   │   └── src/
│   │       └── test/
│   │           └── java/
│   │               └── de/
│   │                   └── philipphauer/
│   │                       └── blog/
│   │                           └── testingrestservice/
│   │                               └── integrationtests/
│   │                                   ├── BlogsTest.java
│   │                                   ├── dto/
│   │                                   │   ├── BlogDTO.java
│   │                                   │   └── BlogListDTO.java
│   │                                   └── dtoKotlin/
│   │                                       ├── BlogDTOKotlin.kt
│   │                                       └── BlogsKotlinTest.kt
│   └── service/
│       ├── .gitignore
│       ├── pom.xml
│       └── src/
│           ├── main/
│           │   ├── java/
│           │   │   └── de/
│           │   │       └── philipphauer/
│           │   │           └── blog/
│           │   │               └── testingrestservice/
│           │   │                   └── service/
│           │   │                       ├── BlogApplication.java
│           │   │                       ├── dataaccess/
│           │   │                       │   ├── BlogRepository.java
│           │   │                       │   ├── DatabaseInitializer.java
│           │   │                       │   ├── PostRepository.java
│           │   │                       │   └── entities/
│           │   │                       │       ├── BlogEntity.java
│           │   │                       │       ├── CommentEntity.java
│           │   │                       │       └── PostEntity.java
│           │   │                       ├── rest/
│           │   │                       │   ├── BlogsResource.java
│           │   │                       │   └── dto/
│           │   │                       │       ├── BlogDTO.java
│           │   │                       │       ├── BlogsDTO.java
│           │   │                       │       └── ReferenceDTO.java
│           │   │                       └── servicecall/
│           │   │                           ├── ImageReference.java
│           │   │                           └── ImageServiceClient.java
│           │   └── resources/
│           │       └── application.properties
│           └── test/
│               └── java/
│                   └── de/
│                       └── philipphauer/
│                           └── blog/
│                               └── testingrestservice/
│                                   └── service/
│                                       └── servicecall/
│                                           └── ImageReferenceServiceClientTest.java
├── ti-continuation-token/
│   ├── .gitignore
│   ├── .mvn/
│   │   └── wrapper/
│   │       ├── maven-wrapper.jar
│   │       └── maven-wrapper.properties
│   ├── README.md
│   ├── mvnw
│   ├── mvnw.cmd
│   ├── pom.xml
│   └── src/
│       ├── main/
│       │   ├── kotlin/
│       │   │   └── de/
│       │   │       └── philipphauer/
│       │   │           └── blog/
│       │   │               └── pagination/
│       │   │                   ├── DesignDAO.kt
│       │   │                   ├── DesignEntity.kt
│       │   │                   ├── DesignResource.kt
│       │   │                   ├── Main.kt
│       │   │                   ├── token/
│       │   │                   │   ├── Model.kt
│       │   │                   │   └── Pagination.kt
│       │   │                   └── util/
│       │   │                       ├── DesignDatabaseUtil.kt
│       │   │                       └── FunctionsMySQL.kt
│       │   └── resources/
│       │       └── create-designs-table.sql
│       └── test/
│           └── kotlin/
│               └── de/
│                   └── philipphauer/
│                       └── blog/
│                           └── pagination/
│                               ├── Common.kt
│                               ├── DesignResourceTest.kt
│                               ├── PaginationClient.kt
│                               └── token/
│                                   └── PaginationTest.kt
├── unit-tests-kotlin/
│   ├── .gitignore
│   ├── pom.xml
│   └── src/
│       ├── main/
│       │   └── kotlin/
│       │       └── com/
│       │           └── phauer/
│       │               └── unittestkotlin/
│       │                   └── MongoDAO.kt
│       └── test/
│           ├── kotlin/
│           │   └── com/
│           │       └── phauer/
│           │           └── unittestkotlin/
│           │               ├── BackticksAndNestedClasses.kt
│           │               ├── DataClassAssertions.kt
│           │               ├── HandlingState.kt
│           │               ├── IntroductionExample.kt
│           │               ├── KGenericContainer.kt
│           │               ├── MockHandling.kt
│           │               ├── MongoDAOTestJUnit4.kt
│           │               ├── MongoDAOTestJUnit5.kt
│           │               ├── ParseTest.kt
│           │               ├── ParseTestKotest.kt
│           │               ├── TestSpecificExtFunctions.kt
│           │               ├── assertAllOrSomeFields/
│           │               │   └── AssertAllOrSomeFields.kt
│           │               ├── foo/
│           │               │   ├── CreationHelper.kt
│           │               │   └── MockK.kt
│           │               └── mockk/
│           │                   ├── UserScheduler.kt
│           │                   └── UserSchedulerTest_MockK.kt
│           └── resources/
│               └── mockito-extensions/
│                   └── org.mockito.plugins.MockMakerXXX
├── uuid-mysql-hibernate/
│   ├── .gitignore
│   ├── README.md
│   ├── docker-compose.yml
│   ├── pom.xml
│   └── src/
│       └── main/
│           ├── java/
│           │   └── de/
│           │       └── philipphauer/
│           │           └── blog/
│           │               ├── ProductsResource.java
│           │               ├── UuidMysqlHibernateApplication.java
│           │               └── model/
│           │                   └── Product.java
│           └── resources/
│               └── application.properties
├── vaadin-10-sass-cssrefresh/
│   ├── .gitignore
│   ├── README.md
│   ├── pom.xml
│   └── src/
│       └── main/
│           ├── java/
│           │   └── com/
│           │       └── phauer/
│           │           └── vaadin10sasscssrefresh/
│           │               ├── CustomVaadinServiceListener.java
│           │               ├── ExampleView.java
│           │               ├── MainLayout.java
│           │               └── Vaadin10SassCssrefreshApplication.java
│           └── resources/
│               ├── META-INF/
│               │   └── resources/
│               │       ├── frontend/
│               │       │   └── styles/
│               │       │       ├── exampleView.scss
│               │       │       ├── main.scss
│               │       │       └── variables.scss
│               │       └── js/
│               │           └── cssrefresh.js
│               └── application.properties
└── versioning-continuous-delivery/
    ├── .gitignore
    ├── README.md
    ├── docker-compose.yml
    ├── pom.xml
    └── src/
        └── main/
            ├── java/
            │   └── de/
            │       └── philipphauer/
            │           └── blog/
            │               └── VersioningContinuousDeliveryApplication.java
            └── resources/
                └── application.properties

================================================
FILE CONTENTS
================================================

================================================
FILE: README.md
================================================
# blog-related


================================================
FILE: cairosvg-on-alpine/.gitignore
================================================
.vscode/

================================================
FILE: cairosvg-on-alpine/Pipfile
================================================
[[source]]

url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"

[packages]

flask = "==0.12.2"
CairoSVG = "==2.1.3"

[dev-packages]

[requires]

python_version = "3.6"


================================================
FILE: cairosvg-on-alpine/README.md
================================================
# Alpine Image with CairoSVG

```bash
# build and start the docker container
docker-compose up
# trigger the svg convertion
curl http://localhost:5000/image
```

For details, check out the `src/Dockerfile`.

# Run the Script on Ubuntu

```bash
# pip install pipenv
pipenv install
pipenv shell
cd src
python svg-converter-service.py
```

That should do the trick (tested on Ubuntu 17.04). However, somehow I used to get the error `ModuleNotFoundError: No module named 'PIL'`.

- Fix a) add the dependency `Pillow = "==5.1.0"` to the Pipfile
- or Fix b) 

```bash
sudo apt-get install python3-dev python3-setuptools
sudo apt-get install python3-dev python3-setuptools libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.5-dev tk8.5-dev
```


================================================
FILE: cairosvg-on-alpine/docker-compose.yml
================================================
version: '3'
services:
  svg-converter-service:
    build: ./src
    ports:
      - "5000:5000"

================================================
FILE: cairosvg-on-alpine/src/Dockerfile
================================================
FROM python:3.6.4-alpine3.7

RUN apk add --no-cache \
    build-base cairo-dev cairo cairo-tools \
    # pillow dependencies
    jpeg-dev zlib-dev freetype-dev lcms2-dev openjpeg-dev tiff-dev tk-dev tcl-dev

RUN pip install "flask==1.0.1" "CairoSVG==2.1.3"

COPY circle.svg /
COPY svg-converter-service.py /
CMD python3 /svg-converter-service.py

================================================
FILE: cairosvg-on-alpine/src/svg-converter-service.py
================================================
import cairosvg
from flask import Flask, Response

app = Flask(__name__)

@app.route('/image')
def convert_image():
    png_data = cairosvg.svg2png(url="circle.svg", parent_width=300, parent_height=300)
    return Response(png_data, mimetype='image/png')

if __name__ == '__main__':
    app.run(debug=True, port=5000, host='0.0.0.0')

================================================
FILE: cleaner-code-with-kotlin/.gitignore
================================================
.idea/
target/
*.iml

================================================
FILE: cleaner-code-with-kotlin/pom.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>de.philipphauer.blog</groupId>
    <artifactId>cleaner-code-with-kotlin</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <kotlin.version>1.1.1</kotlin.version>
        <java.version>1.8</java.version>
        <okhttp.version>3.6.0</okhttp.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-stdlib-jre8</artifactId>
            <version>${kotlin.version}</version>
        </dependency>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-test</artifactId>
            <version>${kotlin.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20160810</version>
        </dependency>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-stdlib-jre8</artifactId>
            <version>${kotlin.version}</version>
        </dependency>
        <dependency>
            <groupId>com.squareup.okhttp3</groupId>
            <artifactId>okhttp</artifactId>
            <version>${okhttp.version}</version>
        </dependency>
        <dependency>
            <groupId>com.squareup.okhttp3</groupId>
            <artifactId>logging-interceptor</artifactId>
            <version>${okhttp.version}</version>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <version>3.6.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
        <testSourceDirectory>${project.basedir}/src/test/kotlin</testSourceDirectory>
        <plugins>
            <plugin>
                <artifactId>kotlin-maven-plugin</artifactId>
                <groupId>org.jetbrains.kotlin</groupId>
                <version>${kotlin.version}</version>
                <executions>
                    <execution>
                        <id>compile</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>test-compile</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>test-compile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.5.1</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
                <executions>
                    <!-- Replacing default-compile as it is treated specially by maven -->
                    <execution>
                        <id>default-compile</id>
                        <phase>none</phase>
                    </execution>
                    <!-- Replacing default-testCompile as it is treated specially by maven -->
                    <execution>
                        <id>default-testCompile</id>
                        <phase>none</phase>
                    </execution>
                    <execution>
                        <id>java-compile</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>java-test-compile</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>testCompile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>

================================================
FILE: cleaner-code-with-kotlin/src/main/kotlin/functions/BeAware.kt
================================================
package functions

fun add(value: String?){
    val map = mutableMapOf<String, String>()


value?.emptyToNull()?.let { map.put("bla", it) }

if (value?.isNotEmpty() ?: false){
    map.put("key", value!!)
}


    
    //KISS
if (!value.isNullOrEmpty()){
    map.put("key", value!!)
}
if (value != null && value.isNotEmpty()){
    map.put("key", value)
}
// or with smart-cast/without null-assertion
}

fun  String.emptyToNull() = if (this.isEmpty()) null else this
    

================================================
FILE: cleaner-code-with-kotlin/src/main/kotlin/functions/Expressions.kt
================================================
package functions

import org.json.JSONException
import org.json.JSONObject

val url = "http://bla.de?asdf"

val delimiterIndex = url.indexOf("?")
val strippedUrl = if (delimiterIndex > 0) {
    url.substring(0, delimiterIndex)
} else {
    url
}

val json = """{"message":"HELLO"}"""
val message = try {
    JSONObject(json).getString("message")
} catch (ex: JSONException) {
    json
}

fun getMessage(json: String): String {
    val message: String = try {
        JSONObject(json).getString("message")
    } catch (ex: JSONException) {
        json
    }
    return message
}
fun getMessage2(json: String) = try {
    JSONObject(json).getString("message")
} catch (ex: JSONException) {
    json
}


================================================
FILE: cleaner-code-with-kotlin/src/main/kotlin/functions/Immutability.kt
================================================
package functions

fun varVal(){

    val id = 1
    // id = 2

    var id2 = 1
    id2 = 2

    println(id)
    println(id2)
}

fun collections() {
val list = listOf(1,2,3,4)
//list.add(1)
val evenList = list.filter { it % 2 == 0 }
}


data class DesignMetaData(
        val id: Int,
        val fileName: String,
        val uploaderId: Int,
        val width: Int = 0,
        val height: Int = 0
)
val design = DesignMetaData(id = 1, fileName = "cat.jpg", uploaderId = 2)
val id = design.id
// design.id = 2
val design2 = design.copy(fileName = "dog.jpg")

enum class DesignType {PIXEL, VECTOR}

================================================
FILE: cleaner-code-with-kotlin/src/main/kotlin/functions/Nullability.kt
================================================
package functions

val value: String = "Clean Code"
//val value2: String = null

val nullValue: String? = "Clean Code"
val nullValue2: String? = null

//val assign1: String = nullValue
val assign2: String = if (nullValue == null) "default" else nullValue //smart-cast
val assign3: String = nullValue ?: "default"




data class Order(val customer: Customer?)
data class Customer(val address: Address?)
data class Address(val city: String)

fun ship(order: Order?){
    //every time you do if-null-checks, hold on.
if (order == null || order.customer == null || order.customer.address == null){
    throw IllegalArgumentException("Invalid Order")
}
val city = order.customer.address.city
}

fun ship2(order: Order?){
    // Often, you can use null-safe call (?.) or the elvis operator (?:) instead.
    val city = order?.customer?.address?.city ?: throw IllegalArgumentException("Invalid Order")
}


interface Service
class CustomerService : Service {
    fun getCustomer() {}
}

fun getMetrics(service: Service){
    // also hold on for if-type-checks
    if (service !is CustomerService) {
        throw IllegalArgumentException("No CustomerService")
    }
    service.getCustomer()
}

fun getMetrics2(service: Service){
    //check type, (smart-)cast it and throw exception if the type is not the expected one. all in one expression!
    service as? CustomerService ?: throw IllegalArgumentException("No CustomerService")
    service.getCustomer()
}


fun foo(order: Order?){
    // avoid yelling !! where every possible. search for better solutions by verifying the variable up front and handle nulls. (quote book)
    order!!.customer!!.address!!.city
}

fun findOrder(): Order? {
    return null
}
fun dun(customer: Customer?){

}

fun handle(){
    // Don't
    val order: Order? = findOrder()
    if (order != null){
        dun(order.customer)
    }

    // with let(), there is no need for an extra variable
    // can write as one expression
    findOrder()?.let { dun(it.customer) }
    findOrder()?.customer?.let(::dun)

}

================================================
FILE: cleaner-code-with-kotlin/src/main/kotlin/functions/ProductClient.java
================================================
package functions;

import okhttp3.Response;
import okhttp3.ResponseBody;

public class ProductClient {

    public Product parseProductFromHttpBody(Response response){
        if (response == null){
            throw new ProductClientException("Response is null!");
        }
        int code = response.code();
        if (code == 200 || code == 201){
            return mapToDTO(response.body());
        }
        if (code >= 400 && code <= 499){
            throw new ProductClientException("Send an invalid request.");
        }
        if (code >= 500 && code <= 599){
            throw new ProductClientException("Server error.");
        }
        throw new ProductClientException("Unknown code " + code);
    }

    private Product mapToDTO(ResponseBody body) {
        return null;
    }

    public static class Product{

    }

    public static class ProductClientException extends RuntimeException{
        public ProductClientException(String message) {
            super(message);
        }
    }
}


================================================
FILE: cleaner-code-with-kotlin/src/main/kotlin/functions/ProductClientKotlin.kt
================================================
package functions

import functions.ProductClient.Product
import functions.ProductClient.ProductClientException
import okhttp3.Response
import okhttp3.ResponseBody

class ProductClientKotlin {

    fun parseProductFromHttpBody(response: Response?) = when (response?.code()){
        null -> throw ProductClientException("Response is null!")
        200, 201 -> mapToDTO(response.body())
        in 400..499 -> throw ProductClientException("Send an invalid request.")
        in 500..599 -> throw ProductClientException("Server error.")
        else -> throw ProductClientException("Error. Code ${response.code()}")
    }

    private fun mapToDTO(body: ResponseBody?): Product {
        return Product()
    }

    fun parseProductFromHttpBody2(response: Response?): Product {
        val product = when (response?.code()) {
            null -> throw ProductClientException("Response is null!")
            200, 201 -> mapToDTO(response.body())
            in 400..499 -> throw ProductClientException("Send an invalid request to server.")
            in 500..599 -> throw ProductClientException("Server error.")
            else -> throw ProductClientException("Error. Code ${response.code()}")
        }
        return product
    }
}


================================================
FILE: compare-payloads/.gitignore
================================================
target
.idea
*iml
compare-scripts/payload-output

================================================
FILE: compare-payloads/README.md
================================================
```
$ mvn package
$ java -jar target/compare-payloads_1.jar # TODO
$ cd compare-scripts
$ sudo apt install httpie libxml2-utils jq meld
$ ./compare-json-payload.jh
$ ./compare-xml-payload.sh
$ ...

```

================================================
FILE: compare-payloads/compare-scripts/compare-all-final.sh
================================================
#!/usr/bin/env bash

if [ -z "$2" ]; then
    fileName=$(basename "$0")
    printf "Paths are not provided! Pattern: \n./$fileName \"http://localhost:8080/blogposts\" \"http://localhost:8080/blogposts2\"\n"
    exit
fi

outputFolder="payload-output"
if [[ ! -e "$outputFolder" ]]; then
    mkdir "$outputFolder"
fi

resource1="$1"
resource2="$2"

compare-payloads(){
    format="$1"
    payload1="$outputFolder/payload1.$format"
    payload2="$outputFolder/payload2.$format"

     if [ "$format" = "json" ]; then
        http "$resource1" Accept:application/json --pretty=none | jq -S . > "$payload1"
        http "$resource2" Accept:application/json --pretty=none | jq -S . > "$payload2"
    else
        http "$resource1" Accept:application/xml --pretty=none | xmllint -c14n - | xmllint --format - > "$payload1"
        http "$resource2" Accept:application/xml --pretty=none | xmllint -c14n - | xmllint --format - > "$payload2"
    fi
    if [ "$(cat "$payload1")" = "$(cat "$payload2")" ]; then
        echo "$format payloads are equal."
    else
        echo "!!!$format payloads are NOT EQUAL!!!"
        # if the payloads are not equal, create a diff and show it to the developer. Let him decide.
        echo "Showing a diff via meld..."
        meld "$payload1" "$payload2"
    fi
}
#TODO pipe output of http to variable, so this can be outside of the if-body. this also prevents redundant echos for the requests. "calling ...".
#TODO xml nodes are not sorted!
#TODO compare files... using cat?

compare-payloads "json"
compare-payloads "xml"

================================================
FILE: compare-payloads/compare-scripts/compare-by-sorting.sh
================================================
#!/usr/bin/env bash

if [[ ! -e "payload-output" ]]; then
    mkdir "payload-output"
fi

http http://localhost:8080/blogposts --pretty=none > payload-output/version1.json
http http://localhost:8080/blogposts2 --pretty=none > payload-output/version2.json
# heuristic: sort all characters of the payload alphanumerical. This leads to rubbish.
# But we can compare the rubbish to determine equality with a high probability.
version1Sorted=$(grep -o . "payload-output/version1.json" | sort | tr -d "\n")
version2Sorted=$(grep -o . "payload-output/version2.json" | sort | tr -d "\n")
if [ "$version1Sorted" = "$version2Sorted" ]; then
    echo "JSON payloads are equal."
else
    echo "!!!JSON payloads are NOT EQUAL!!!"
    meld payload-output/version1.json payload-output/version2.json
fi

================================================
FILE: compare-payloads/compare-scripts/compare-json-payload.sh
================================================
#!/usr/bin/env bash

if [[ ! -e "payload-output" ]]; then
    mkdir "payload-output"
fi

http http://localhost:8080/blogposts --pretty=none | jq -S . > payload-output/version1.json
http http://localhost:8080/blogposts2 --pretty=none | jq -S . > payload-output/version2.json
meld payload-output/version1.json payload-output/version2.json


================================================
FILE: compare-payloads/compare-scripts/compare-xml-payload.sh
================================================
#!/usr/bin/env bash

if [[ ! -e "payload-output" ]]; then
    mkdir "payload-output"
fi

http http://localhost:8080/blogposts Accept:application/xml --pretty=none | xmllint -c14n - | xmllint --format - > payload-output/version1.xml
http http://localhost:8080/blogposts2 Accept:application/xml --pretty=none | xmllint -c14n - | xmllint --format - > payload-output/version2.xml
meld payload-output/version1.xml payload-output/version2.xml
#TODO xml nodes are not sorted!
#TODO difference between canonical format 1.0 and 1.1

================================================
FILE: compare-payloads/pom.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<groupId>de.philipphauer.blog</groupId>
	<artifactId>compare-payloads</artifactId>
	<version>1</version>
	<packaging>jar</packaging>

	<name>compare-payloads</name>
	<description></description>

	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>1.3.6.RELEASE</version>
		<relativePath/> <!-- lookup parent from repository -->
	</parent>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
		<java.version>1.8</java.version>
	</properties>

	<dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
		</dependency>
		<dependency>
			<groupId>com.fasterxml.jackson.dataformat</groupId>
			<artifactId>jackson-dataformat-xml</artifactId>
		</dependency>
		<dependency>
			<groupId>com.fasterxml.jackson.datatype</groupId>
			<artifactId>jackson-datatype-jsr310</artifactId>
			<version>2.6.1</version>
		</dependency>

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
		</dependency>

	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
			</plugin>
		</plugins>
	</build>


</project>


================================================
FILE: compare-payloads/src/main/java/de/philipphauer/blog/BlogPost.java
================================================
package de.philipphauer.blog;

import javax.xml.bind.annotation.XmlRootElement;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZonedDateTime;

public class BlogPost {

    private String author;
    private String content;
    private Instant created;

    public String getAuthor() {
        return author;
    }

    public BlogPost setAuthor(String author) {
        this.author = author;
        return this;
    }

    public String getContent() {
        return content;
    }

    public BlogPost setContent(String content) {
        this.content = content;
        return this;
    }

    public Instant getCreated() {
        return created;
    }

    public BlogPost setCreated(Instant created) {
        this.created = created;
        return this;
    }
}


================================================
FILE: compare-payloads/src/main/java/de/philipphauer/blog/BlogPost2.java
================================================
package de.philipphauer.blog;

import javax.xml.bind.annotation.XmlRootElement;

public class BlogPost2 {

    private String authorName;
    private String created;
    private String content;

    public String getAuthorName() {
        return authorName;
    }

    public BlogPost2 setAuthorName(String authorName) {
        this.authorName = authorName;
        return this;
    }

    public String getContent() {
        return content;
    }

    public BlogPost2 setContent(String content) {
        this.content = content;
        return this;
    }

    public String getCreated() {
        return created;
    }

    public BlogPost2 setCreated(String created) {
        this.created = created;
        return this;
    }
}


================================================
FILE: compare-payloads/src/main/java/de/philipphauer/blog/ComparePayloadApplication.java
================================================
package de.philipphauer.blog;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.Instant;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;

@SpringBootApplication
@RestController
public class ComparePayloadApplication {

	public static void main(String[] args) {
		SpringApplication.run(ComparePayloadApplication.class, args);
	}

    List<BlogPost> blogPosts = new ArrayList<>();
    List<BlogPost2> blogPosts2 = new ArrayList<>();

    public ComparePayloadApplication(){
        Instant now = Instant.now();
        blogPosts.add(new BlogPost().setAuthor("Philipp").setContent("Super Post").setCreated(now));
        blogPosts.add(new BlogPost().setAuthor("Peter").setContent("Nice Post").setCreated(now.minusSeconds(60)));
        blogPosts.add(new BlogPost().setAuthor("Albert").setContent("Great Post").setCreated(now.minusSeconds(60*60)));
        blogPosts2.add(new BlogPost2().setAuthorName("Philipp").setContent("Super Post").setCreated(format(now)));
        blogPosts2.add(new BlogPost2().setAuthorName("Peter").setContent("Nice Post").setCreated(format(now.minusSeconds(60))));
        blogPosts2.add(new BlogPost2().setAuthorName("Albert").setContent("Great Post").setCreated(format(now.minusSeconds(60*60))));
    }

	@RequestMapping(value = "/blogposts", produces = {MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE})
	public List<BlogPost> getBlogPosts() {
        return blogPosts;
	}

    @RequestMapping(value = "/blogposts2", produces = {MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE})
    public List<BlogPost2> getBlogPosts2() {
        return blogPosts2;
    }

    public static final DateTimeFormatter FORMATTER = DateTimeFormatter.ISO_OFFSET_DATE_TIME;

    private String format(Instant now) {
        ZonedDateTime zonedDateTime = ZonedDateTime.ofInstant(now, ZoneOffset.UTC);
        return FORMATTER.format(zonedDateTime);
    }
}


================================================
FILE: compare-payloads/src/main/resources/application.properties
================================================


================================================
FILE: continuation-token/.gitignore
================================================
.idea/
*.iml


================================================
FILE: continuation-token/README.md
================================================
# REST API Pagination Example Application

# Getting Started

```bash
cd continuation-token
./mvnw install
cd ../demo-kotlin
./mvnw package && java -jar target/demo-kotlin*.jar
```

Open `http://localhost:8000/designs?pageSize=3` in your browser an click on the URL in the `nextPage` field in the json payload.

# The Application

It's a lightweight HTTP service written in Kotlin and powered by [HTTP4K](https://www.http4k.org/). It starts within 600 ms. ;-) 


================================================
FILE: continuation-token/continuation-token/.gitignore
================================================
target/
!.mvn/wrapper/maven-wrapper.jar
.idea/
*.iml

================================================
FILE: continuation-token/continuation-token/.mvn/wrapper/maven-wrapper.properties
================================================
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.2/apache-maven-3.5.2-bin.zip


================================================
FILE: continuation-token/continuation-token/mvnw
================================================
#!/bin/sh
# ----------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
# ----------------------------------------------------------------------------

# ----------------------------------------------------------------------------
# Maven2 Start Up Batch script
#
# Required ENV vars:
# ------------------
#   JAVA_HOME - location of a JDK home dir
#
# Optional ENV vars
# -----------------
#   M2_HOME - location of maven2's installed home dir
#   MAVEN_OPTS - parameters passed to the Java VM when running Maven
#     e.g. to debug Maven itself, use
#       set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
#   MAVEN_SKIP_RC - flag to disable loading of mavenrc files
# ----------------------------------------------------------------------------

if [ -z "$MAVEN_SKIP_RC" ] ; then

  if [ -f /etc/mavenrc ] ; then
    . /etc/mavenrc
  fi

  if [ -f "$HOME/.mavenrc" ] ; then
    . "$HOME/.mavenrc"
  fi

fi

# OS specific support.  $var _must_ be set to either true or false.
cygwin=false;
darwin=false;
mingw=false
case "`uname`" in
  CYGWIN*) cygwin=true ;;
  MINGW*) mingw=true;;
  Darwin*) darwin=true
    # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
    # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
    if [ -z "$JAVA_HOME" ]; then
      if [ -x "/usr/libexec/java_home" ]; then
        export JAVA_HOME="`/usr/libexec/java_home`"
      else
        export JAVA_HOME="/Library/Java/Home"
      fi
    fi
    ;;
esac

if [ -z "$JAVA_HOME" ] ; then
  if [ -r /etc/gentoo-release ] ; then
    JAVA_HOME=`java-config --jre-home`
  fi
fi

if [ -z "$M2_HOME" ] ; then
  ## resolve links - $0 may be a link to maven's home
  PRG="$0"

  # need this for relative symlinks
  while [ -h "$PRG" ] ; do
    ls=`ls -ld "$PRG"`
    link=`expr "$ls" : '.*-> \(.*\)$'`
    if expr "$link" : '/.*' > /dev/null; then
      PRG="$link"
    else
      PRG="`dirname "$PRG"`/$link"
    fi
  done

  saveddir=`pwd`

  M2_HOME=`dirname "$PRG"`/..

  # make it fully qualified
  M2_HOME=`cd "$M2_HOME" && pwd`

  cd "$saveddir"
  # echo Using m2 at $M2_HOME
fi

# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
  [ -n "$M2_HOME" ] &&
    M2_HOME=`cygpath --unix "$M2_HOME"`
  [ -n "$JAVA_HOME" ] &&
    JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
  [ -n "$CLASSPATH" ] &&
    CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi

# For Migwn, ensure paths are in UNIX format before anything is touched
if $mingw ; then
  [ -n "$M2_HOME" ] &&
    M2_HOME="`(cd "$M2_HOME"; pwd)`"
  [ -n "$JAVA_HOME" ] &&
    JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
  # TODO classpath?
fi

if [ -z "$JAVA_HOME" ]; then
  javaExecutable="`which javac`"
  if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
    # readlink(1) is not available as standard on Solaris 10.
    readLink=`which readlink`
    if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
      if $darwin ; then
        javaHome="`dirname \"$javaExecutable\"`"
        javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
      else
        javaExecutable="`readlink -f \"$javaExecutable\"`"
      fi
      javaHome="`dirname \"$javaExecutable\"`"
      javaHome=`expr "$javaHome" : '\(.*\)/bin'`
      JAVA_HOME="$javaHome"
      export JAVA_HOME
    fi
  fi
fi

if [ -z "$JAVACMD" ] ; then
  if [ -n "$JAVA_HOME"  ] ; then
    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
      # IBM's JDK on AIX uses strange locations for the executables
      JAVACMD="$JAVA_HOME/jre/sh/java"
    else
      JAVACMD="$JAVA_HOME/bin/java"
    fi
  else
    JAVACMD="`which java`"
  fi
fi

if [ ! -x "$JAVACMD" ] ; then
  echo "Error: JAVA_HOME is not defined correctly." >&2
  echo "  We cannot execute $JAVACMD" >&2
  exit 1
fi

if [ -z "$JAVA_HOME" ] ; then
  echo "Warning: JAVA_HOME environment variable is not set."
fi

CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher

# traverses directory structure from process work directory to filesystem root
# first directory with .mvn subdirectory is considered project base directory
find_maven_basedir() {

  if [ -z "$1" ]
  then
    echo "Path not specified to find_maven_basedir"
    return 1
  fi

  basedir="$1"
  wdir="$1"
  while [ "$wdir" != '/' ] ; do
    if [ -d "$wdir"/.mvn ] ; then
      basedir=$wdir
      break
    fi
    # workaround for JBEAP-8937 (on Solaris 10/Sparc)
    if [ -d "${wdir}" ]; then
      wdir=`cd "$wdir/.."; pwd`
    fi
    # end of workaround
  done
  echo "${basedir}"
}

# concatenates all lines of a file
concat_lines() {
  if [ -f "$1" ]; then
    echo "$(tr -s '\n' ' ' < "$1")"
  fi
}

BASE_DIR=`find_maven_basedir "$(pwd)"`
if [ -z "$BASE_DIR" ]; then
  exit 1;
fi

export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
echo $MAVEN_PROJECTBASEDIR
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"

# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
  [ -n "$M2_HOME" ] &&
    M2_HOME=`cygpath --path --windows "$M2_HOME"`
  [ -n "$JAVA_HOME" ] &&
    JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
  [ -n "$CLASSPATH" ] &&
    CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
  [ -n "$MAVEN_PROJECTBASEDIR" ] &&
    MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
fi

WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain

exec "$JAVACMD" \
  $MAVEN_OPTS \
  -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
  "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
  ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"


================================================
FILE: continuation-token/continuation-token/mvnw.cmd
================================================
@REM ----------------------------------------------------------------------------
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements.  See the NOTICE file
@REM distributed with this work for additional information
@REM regarding copyright ownership.  The ASF licenses this file
@REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance
@REM with the License.  You may obtain a copy of the License at
@REM
@REM    http://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing,
@REM software distributed under the License is distributed on an
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM KIND, either express or implied.  See the License for the
@REM specific language governing permissions and limitations
@REM under the License.
@REM ----------------------------------------------------------------------------

@REM ----------------------------------------------------------------------------
@REM Maven2 Start Up Batch script
@REM
@REM Required ENV vars:
@REM JAVA_HOME - location of a JDK home dir
@REM
@REM Optional ENV vars
@REM M2_HOME - location of maven2's installed home dir
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
@REM     e.g. to debug Maven itself, use
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
@REM ----------------------------------------------------------------------------

@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@echo off
@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
@if "%MAVEN_BATCH_ECHO%" == "on"  echo %MAVEN_BATCH_ECHO%

@REM set %HOME% to equivalent of $HOME
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")

@REM Execute a user defined script before this one
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
:skipRcPre

@setlocal

set ERROR_CODE=0

@REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal

@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome

echo.
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error

:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init

echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error

@REM ==== END VALIDATION ====

:init

@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found.

set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir

set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR%
:findBaseDir
IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD%
goto findBaseDir

:baseDirFound
set MAVEN_PROJECTBASEDIR=%WDIR%
cd "%EXEC_DIR%"
goto endDetectBaseDir

:baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%"

:endDetectBaseDir

IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig

@setlocal EnableExtensions EnableDelayedExpansion
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%

:endReadAdditionalConfig

SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"

set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain

%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
if ERRORLEVEL 1 goto error
goto end

:error
set ERROR_CODE=1

:end
@endlocal & set ERROR_CODE=%ERROR_CODE%

if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
@REM check for post script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
:skipRcPost

@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
if "%MAVEN_BATCH_PAUSE%" == "on" pause

if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%

exit /B %ERROR_CODE%


================================================
FILE: continuation-token/continuation-token/pom.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <!--TODO groupId, url, developers, github url (see http://central.sonatype.org/pages/requirements.html) -->

    <groupId>de.philipphauer.blog</groupId>
    <artifactId>continuation-token</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>Continuation-Token</name>
    <description>Handy library to implement fast and reliable API pagination</description>

    <licenses>
        <license>
            <name>MIT License</name>
            <url>http://www.opensource.org/licenses/mit-license.php</url>
        </license>
    </licenses>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <kotlin.version>1.1.60</kotlin.version>
        <junit5.version>5.0.2</junit5.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-stdlib</artifactId>
            <version>${kotlin.version}</version>
        </dependency>
        <!-- test -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>${junit5.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-params</artifactId>
            <version>${junit5.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <version>3.8.0</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <sourceDirectory>src/main/kotlin</sourceDirectory>
        <testSourceDirectory>src/test/kotlin</testSourceDirectory>

        <plugins>
            <plugin>
                <groupId>org.jetbrains.kotlin</groupId>
                <artifactId>kotlin-maven-plugin</artifactId>
                <version>${kotlin.version}</version>
                <executions>
                    <execution>
                        <id>compile</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>test-compile</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>test-compile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.19</version>
                <dependencies>
                    <dependency>
                        <groupId>org.junit.platform</groupId>
                        <artifactId>junit-platform-surefire-provider</artifactId>
                        <version>1.0.2</version>
                    </dependency>
                    <dependency>
                        <groupId>org.junit.jupiter</groupId>
                        <artifactId>junit-jupiter-engine</artifactId>
                        <version>${junit5.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>3.0.1</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.jetbrains.dokka</groupId>
                <artifactId>dokka-maven-plugin</artifactId>
                <version>0.9.15</version>
                <executions>
                    <execution>
                        <phase>pre-site</phase>
                        <goals>
                            <goal>javadocJar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <pluginRepositories>
        <pluginRepository>
            <id>jcenter</id>
            <name>JCenter</name>
            <url>https://jcenter.bintray.com/</url>
        </pluginRepository>
    </pluginRepositories>
</project>


================================================
FILE: continuation-token/continuation-token/src/main/kotlin/de/philipphauer/blog/pagination/ContinuationTokenParser.kt
================================================
package de.philipphauer.blog.pagination

object ContinuationTokenParser {
    val DELIMITER = ":"

    fun parse(tokenString: String): ContinuationToken{
        val parts = tokenString.split(DELIMITER)
        try {
            return ContinuationToken(
                    timestamp = parts[0].toLong(),
                    offset = parts[1].toInt(),
                    checksum = parts[2].toLong()
            )
        } catch (ex: Exception){
            throw ContinuationTokenParseException("Invalid token '$tokenString'.", ex)
        }
    }
}

class ContinuationTokenParseException(message: String, cause: Exception) : RuntimeException(message, cause)

================================================
FILE: continuation-token/continuation-token/src/main/kotlin/de/philipphauer/blog/pagination/Model.kt
================================================
package de.philipphauer.blog.pagination

import de.philipphauer.blog.pagination.ContinuationTokenParser.DELIMITER

/** a token points to the last element of the current page. "last" usually means "highest timestamp". **/
data class ContinuationToken(
        /** timestamp of the highest entity in the last page. */
        val timestamp: Long,
        /** offset = amount of entities with the highest timestamp in the last page, that have the same timestamp */
        val offset: Int,
        /** used to detect modifications during pagination */
        val checksum: Long
) {
    override fun toString() = "$timestamp$DELIMITER$offset$DELIMITER$checksum"
}

data class QueryAdvice(
        /** use this with >= in the WHERE clause (the equals is important!) */
        val timestamp: Long,
        val limit: Int
)

data class Page(
        val entities: List<Pageable>,
        val currentToken: ContinuationToken?
)

interface Pageable {
    fun getID(): String
    fun getTimestamp(): Long
}

================================================
FILE: continuation-token/continuation-token/src/main/kotlin/de/philipphauer/blog/pagination/Pagination.kt
================================================
package de.philipphauer.blog.pagination

import java.util.zip.CRC32

object Pagination{

    //TODO implement checksum fallback

    fun createPage(entitiesSinceIncludingTs: List<Pageable>, oldToken: ContinuationToken?, requiredPageSize: Int): Page {
        if (entitiesSinceIncludingTs.isEmpty()){
            return Page(entities = listOf(), currentToken = null)
        }
        if (oldToken == null || currentPageStartsWithADifferentTimestampThanInToken(entitiesSinceIncludingTs, oldToken)){
            //don't skip
            val token = createTokenForPage(entitiesSinceIncludingTs, entitiesSinceIncludingTs, requiredPageSize)
            return Page(entities = entitiesSinceIncludingTs, currentToken = token)
        } else {
            val entitiesForNextPage = skipOffset(entitiesSinceIncludingTs, oldToken)
            val token = createTokenForPage(entitiesSinceIncludingTs, entitiesForNextPage, requiredPageSize)
            return Page(entities = entitiesForNextPage, currentToken = token)
        }
    }

    private fun fillUpWholePage(entities: List<Pageable>, requiredPageSize: Int): Boolean =
            entities.size >= requiredPageSize

    private fun currentPageStartsWithADifferentTimestampThanInToken(allEntitiesSinceIncludingTs: List<Pageable>, oldToken: ContinuationToken): Boolean {
        val timestampOfFirstElement = allEntitiesSinceIncludingTs.first().getTimestamp()
        return timestampOfFirstElement != oldToken.timestamp
    }

    fun calculateQueryAdvice(token: ContinuationToken?, pageSize: Int): QueryAdvice {
        if (token == null){
            return QueryAdvice(limit = pageSize, timestamp = 0)
        }
        return QueryAdvice(limit = token.offset + pageSize, timestamp = token.timestamp)
    }

    private fun skipOffset(entitiesSinceIncludingTs: List<Pageable>, currentToken: ContinuationToken) =
            entitiesSinceIncludingTs.subList(currentToken.offset, entitiesSinceIncludingTs.size)

    /**
     * @param entitiesForNextPage includes skip/offset
     */
    internal fun createTokenForPage(allEntitiesSinceIncludingTs: List<Pageable>,
                                    entitiesForNextPage: List<Pageable>,
                                    requiredPageSize: Int): ContinuationToken? {
        if (allEntitiesSinceIncludingTs.isEmpty()){
            return null
        }
        if (!fillUpWholePage(entitiesForNextPage, requiredPageSize)){
            return null // no next token required
        }
        val highestEntities = getEntitiesWithHighestTimestamp(allEntitiesSinceIncludingTs)
        val highestTimestamp = highestEntities.last().getTimestamp()
        val ids = highestEntities.map(Pageable::getID)
        val checksum = createCRC32Checksum(ids)
        return ContinuationToken(
                timestamp = highestTimestamp,
                offset = highestEntities.size,
                checksum = checksum
        )
    }

    private fun createCRC32Checksum(ids: List<String>): Long {
        val hash = CRC32()
        hash.update(ids.joinToString("_").toByteArray())
        return hash.value
    }

    internal fun getEntitiesWithHighestTimestamp(entities: List<Pageable>): List<Pageable> {
        if (entities.isEmpty()){
            return listOf()
        }
        val highestTimestamp = entities.last().getTimestamp()
        val entitiesWithHighestTimestamp = mutableListOf<Pageable>()

        val lastIndex = entities.size - 1
        var i = lastIndex
        while (i >= 0 && highestTimestamp == entities[i].getTimestamp()) {
            entitiesWithHighestTimestamp.add(entities[i])
            i--
        }
        return entitiesWithHighestTimestamp.reversed()
    }

}

================================================
FILE: continuation-token/continuation-token/src/test/kotlin/de/philipphauer/blog/pagination/ContinuationTokenParserTest.kt
================================================
package de.philipphauer.blog.pagination

import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Assertions.assertThrows
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.TestInstance
import org.junit.jupiter.params.ParameterizedTest
import org.junit.jupiter.params.provider.MethodSource
import java.util.stream.Stream

@TestInstance(TestInstance.Lifecycle.PER_CLASS)
internal class ContinuationTokenParserTest {

    private val parser = ContinuationTokenParser

    @Test
    fun valid() {
        assertThat(parser.parse("1511443755:2:1842515611"))
                .isEqualTo(ContinuationToken(timestamp = 1511443755, offset = 2, checksum = 1842515611))
        assertThat(parser.parse("1511443755:1:1842521611"))
                .isEqualTo(ContinuationToken(timestamp = 1511443755, offset = 1, checksum = 1842521611))

        //also support timestamps with millisecond precision
        assertThat(parser.parse("1511443755999:1:1842521611"))
                .isEqualTo(ContinuationToken(timestamp = 1511443755999, offset = 1, checksum = 1842521611))
    }

    @ParameterizedTest
    @MethodSource("invalidTokenProvider")
    fun invalid(invalidToken: String) {
        val exception = assertThrows(ContinuationTokenParseException::class.java){
            parser.parse(invalidToken)
        }
        assertThat(exception.message).isEqualTo("Invalid token '$invalidToken'.")
    }

    private fun invalidTokenProvider(): Stream<String> = Stream.of(
            "asdf:1:1842521611"
            , "1511443755:sadfasd:1842521611"
            , "1511443755:1:sadfasd"
            , "1511443755:1"
            , "1511443755:1:"
            , ""
            , "::"
            , "12::"
            , "12::213"
            , ":1231:213"
    )
}


================================================
FILE: continuation-token/continuation-token/src/test/kotlin/de/philipphauer/blog/pagination/PaginationTest.kt
================================================
package de.philipphauer.blog.pagination

import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Nested
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.TestInstance
import java.util.zip.CRC32

@TestInstance(TestInstance.Lifecycle.PER_CLASS)
internal class PaginationTest{

    @Nested
    inner class `createPage` {
        @Test
        fun `|1,2,3|4,5,6| different keys`() {
            val allEntries = listOf(
                    TestPageable(1),
                    TestPageable(2),
                    TestPageable(3),
                    TestPageable(4),
                    TestPageable(5),
                    TestPageable(6)
            )
            val firstPage = allEntries.getEntriesSinceIncluding(timestamp = 0, limit = 3)

            val page = Pagination.createPage(firstPage, null, 3)
            assertThat(page).isEqualTo(Page(
                    entities = listOf(
                            TestPageable(1),
                            TestPageable(2),
                            TestPageable(3)
                    ),
                    currentToken = ContinuationToken(timestamp = 3, offset = 1, checksum = checksum("3"))
            ))

            val entriesSinceKey = allEntries.getEntriesSinceIncluding(timestamp = 3, limit = 4)
            val page2 = Pagination.createPage(entriesSinceKey, page.currentToken, 3)
            assertThat(page2).isEqualTo(Page(
                    entities = listOf(
                            TestPageable(4),
                            TestPageable(5),
                            TestPageable(6)
                    ),
                    currentToken = ContinuationToken(timestamp = 6, offset = 1, checksum = checksum("6"))
            ))
        }

        @Test
        fun `|1,2,3|3,5,6| key 3 overlaps two pages`() {
            val allEntries = listOf(
                    TestPageable("1", 1),
                    TestPageable("2", 2),
                    TestPageable("3", 3),
                    TestPageable("4", 3),
                    TestPageable("5", 5),
                    TestPageable("6", 6)
            )
            val firstPage = allEntries.getEntriesSinceIncluding(timestamp = 0, limit = 3)

            val page = Pagination.createPage(firstPage, null, 3)
            assertThat(page).isEqualTo(Page(
                    entities = listOf(
                            TestPageable("1", 1),
                            TestPageable("2", 2),
                            TestPageable("3", 3)
                    ),
                    currentToken = ContinuationToken(timestamp = 3, offset = 1, checksum = checksum("3"))
            ))

            val entriesSinceKey = allEntries.getEntriesSinceIncluding(timestamp = 3, limit = 4)
            val page2 = Pagination.createPage(entriesSinceKey, page.currentToken, 3)
            assertThat(page2).isEqualTo(Page(
                    entities = listOf(
                            TestPageable("4", 3),
                            TestPageable("5", 5),
                            TestPageable("6", 6)
                    ),
                    currentToken = ContinuationToken(timestamp = 6, offset = 1, checksum = checksum("6"))
            ))
        }

        @Test
        fun `|1,1,1|1,1,1| all have same key`() {
            val allEntries = listOf(
                    TestPageable("1", 1),
                    TestPageable("2", 1),
                    TestPageable("3", 1),
                    TestPageable("4", 1),
                    TestPageable("5", 1),
                    TestPageable("6", 1)
            )
            val firstPage = allEntries.getEntriesSinceIncluding(timestamp = 0, limit = 3)
            val page = Pagination.createPage(firstPage, null, 3)
            assertThat(page).isEqualTo(Page(
                    entities = listOf(
                            TestPageable("1", 1),
                            TestPageable("2", 1),
                            TestPageable("3", 1)
                    ),
                    currentToken = ContinuationToken(timestamp = 1, offset = 3, checksum = checksum("1", "2", "3"))
            ))

            val entriesSinceKey = allEntries.getEntriesSinceIncluding(timestamp = 1, limit = 6)
            val page2 = Pagination.createPage(entriesSinceKey, page.currentToken, 3)
            assertThat(page2).isEqualTo(Page(
                    entities = listOf(
                            TestPageable("4", 1),
                            TestPageable("5", 1),
                            TestPageable("6", 1)
                    ),
                    currentToken = ContinuationToken(timestamp = 1, offset = 6, checksum = checksum("1", "2", "3", "4", "5", "6"))
            ))
        }

        @Test
        fun `|1,2,3|| although it's the last page it fits right into the page size so we can't tell if this is the last page and have to pass a next token`() {
            val allEntries = listOf(
                    TestPageable(1),
                    TestPageable(2),
                    TestPageable(3)
            )
            val firstPage = allEntries.getEntriesSinceIncluding(timestamp = 0, limit = 3)

            val page = Pagination.createPage(firstPage, null, 3)
            assertThat(page).isEqualTo(Page(
                    entities = listOf(
                            TestPageable(1),
                            TestPageable(2),
                            TestPageable(3)
                    ),
                    currentToken = ContinuationToken(timestamp = 3, offset = 1, checksum = checksum("3"))
            ))

            val entriesSinceKey = allEntries.getEntriesSinceIncluding(timestamp = 3, limit = 3)
            val page2 = Pagination.createPage(entriesSinceKey, page.currentToken, 3)
            assertThat(page2).isEqualTo(Page(
                    entities = listOf(),
                    currentToken = null
            ))
        }

        @Test
        fun `|1,2| no next token if there are less elements than page size`() {
            val allEntries = listOf(
                    TestPageable(1),
                    TestPageable(2)
            )
            val firstPage = allEntries.getEntriesSinceIncluding(timestamp = 0, limit = 3)

            val page = Pagination.createPage(firstPage, null, 3)
            assertThat(page).isEqualTo(Page(
                    entities = listOf(
                            TestPageable(1),
                            TestPageable(2)
                    ),
                    currentToken = null
            ))
        }

        @Test
        fun `|1,2,3|4| still skip correctly even if there are less elements than page size`() {
            val allEntries = listOf(
                    TestPageable(1),
                    TestPageable(2),
                    TestPageable(3),
                    TestPageable(4)
            )
            val firstPage = allEntries.getEntriesSinceIncluding(timestamp = 0, limit = 3)

            val page = Pagination.createPage(firstPage, null, 3)
            assertThat(page).isEqualTo(Page(
                    entities = listOf(
                            TestPageable(1),
                            TestPageable(2),
                            TestPageable(3)
                    ),
                    currentToken = ContinuationToken(timestamp = 3, offset = 1, checksum = checksum("3"))
            ))

            val entriesSinceKey = allEntries.getEntriesSinceIncluding(timestamp = 3, limit = 3)
            val page2 = Pagination.createPage(entriesSinceKey, page.currentToken, 3)
            assertThat(page2).isEqualTo(Page(
                    entities = listOf(
                            TestPageable(4)
                    ),
                    currentToken = null
            ))
        }

        @Test
        fun `|1,2,3|4,5| second page is not full so no next token`() {
            val allEntries = listOf(
                    TestPageable(1),
                    TestPageable(2),
                    TestPageable(3),
                    TestPageable(4),
                    TestPageable(5)
            )
            val firstPage = allEntries.getEntriesSinceIncluding(timestamp = 0, limit = 3)

            val page = Pagination.createPage(firstPage, null, 3)
            assertThat(page).isEqualTo(Page(
                    entities = listOf(
                            TestPageable(1),
                            TestPageable(2),
                            TestPageable(3)
                    ),
                    currentToken = ContinuationToken(timestamp = 3, offset = 1, checksum = checksum("3"))
            ))

            val entriesSinceKey = allEntries.getEntriesSinceIncluding(timestamp = 3, limit = 3)
            val page2 = Pagination.createPage(entriesSinceKey, page.currentToken, 3)
            assertThat(page2).isEqualTo(Page(
                    entities = listOf(
                            TestPageable(4),
                            TestPageable(5)
                    ),
                    currentToken = null
            ))
        }

        @Test
        fun `|| empty page`() {
            val page = Pagination.createPage(listOf(), null, 3)
            assertThat(page).isEqualTo(Page(
                    entities = listOf(),
                    currentToken = null
            ))
        }

        @Test
        fun `|1,3,3|4,5,6|`() {
            val allEntries = listOf(
                    TestPageable("1", 1),
                    TestPageable("2", 3),
                    TestPageable("3", 3),
                    TestPageable("4", 4),
                    TestPageable("5", 5),
                    TestPageable("6", 6)
            )
            val firstPage = allEntries.getEntriesSinceIncluding(timestamp = 0, limit = 3)

            val page = Pagination.createPage(firstPage, null, 3)
            assertThat(page).isEqualTo(Page(
                    entities = listOf(
                            TestPageable("1", 1),
                            TestPageable("2", 3),
                            TestPageable("3", 3)
                    ),
                    currentToken = ContinuationToken(timestamp = 3, offset = 2, checksum = checksum("2", "3"))
            ))

            val entriesSinceKey = allEntries.getEntriesSinceIncluding(timestamp = 3, limit = 5)
            val page2 = Pagination.createPage(entriesSinceKey, page.currentToken, 3)
            assertThat(page2).isEqualTo(Page(
                    entities = listOf(
                            TestPageable("4", 4),
                            TestPageable("5", 5),
                            TestPageable("6", 6)
                    ),
                    currentToken = ContinuationToken(timestamp = 6, offset = 1, checksum = checksum("6"))
            ))
        }

        @Test
        fun `|1,3,3|3,5,6|`() {
            val allEntries = listOf(
                    TestPageable("1", 1),
                    TestPageable("2", 3),
                    TestPageable("3", 3),
                    TestPageable("4", 3),
                    TestPageable("5", 5),
                    TestPageable("6", 6)
            )
            val firstPage = allEntries.getEntriesSinceIncluding(timestamp = 0, limit = 3)

            val page = Pagination.createPage(firstPage, null, 3)
            assertThat(page).isEqualTo(Page(
                    entities = listOf(
                            TestPageable("1", 1),
                            TestPageable("2", 3),
                            TestPageable("3", 3)
                    ),
                    currentToken = ContinuationToken(timestamp = 3, offset = 2, checksum = checksum("2", "3"))
            ))

            val entriesSinceKey = allEntries.getEntriesSinceIncluding(timestamp = 3, limit = 5)
            val page2 = Pagination.createPage(entriesSinceKey, page.currentToken, 3)
            assertThat(page2).isEqualTo(Page(
                    entities = listOf(
                            TestPageable("4", 3),
                            TestPageable("5", 5),
                            TestPageable("6", 6)
                    ),
                    currentToken = ContinuationToken(timestamp = 6, offset = 1, checksum = checksum("6"))
            ))
        }

        @Test
        fun `|1,3,3|3,3,6|`() {
            val allEntries = listOf(
                    TestPageable("1", 1),
                    TestPageable("2", 3),
                    TestPageable("3", 3),
                    TestPageable("4", 3),
                    TestPageable("5", 3),
                    TestPageable("6", 6)
            )
            val firstPage = allEntries.getEntriesSinceIncluding(timestamp = 0, limit = 3)

            val page = Pagination.createPage(firstPage, null, 3)
            assertThat(page).isEqualTo(Page(
                    entities = listOf(
                            TestPageable("1", 1),
                            TestPageable("2", 3),
                            TestPageable("3", 3)
                    ),
                    currentToken = ContinuationToken(timestamp = 3, offset = 2, checksum = checksum("2", "3"))
            ))

            val entriesSinceKey = allEntries.getEntriesSinceIncluding(timestamp = 3, limit = 5)
            val page2 = Pagination.createPage(entriesSinceKey, page.currentToken, 3)
            assertThat(page2).isEqualTo(Page(
                    entities = listOf(
                            TestPageable("4", 3),
                            TestPageable("5", 3),
                            TestPageable("6", 6)
                    ),
                    currentToken = ContinuationToken(timestamp = 6, offset = 1, checksum = checksum("6"))
            ))
        }

        @Test
        fun `|1,2,3|3,3,6|`() {
            val allEntries = listOf(
                    TestPageable("1", 1),
                    TestPageable("2", 2),
                    TestPageable("3", 3),
                    TestPageable("4", 3),
                    TestPageable("5", 3),
                    TestPageable("6", 6)
            )
            val firstPage = allEntries.getEntriesSinceIncluding(timestamp = 0, limit = 3)

            val page = Pagination.createPage(firstPage, null, 3)
            assertThat(page).isEqualTo(Page(
                    entities = listOf(
                            TestPageable("1", 1),
                            TestPageable("2", 2),
                            TestPageable("3", 3)
                    ),
                    currentToken = ContinuationToken(timestamp = 3, offset = 1, checksum = checksum("3"))
            ))

            val entriesSinceKey = allEntries.getEntriesSinceIncluding(timestamp = 3, limit = 5)
            val page2 = Pagination.createPage(entriesSinceKey, page.currentToken, 3)
            assertThat(page2).isEqualTo(Page(
                    entities = listOf(
                            TestPageable("4", 3),
                            TestPageable("5", 3),
                            TestPageable("6", 6)
                    ),
                    currentToken = ContinuationToken(timestamp = 6, offset = 1, checksum = checksum("6"))
            ))
        }

        @Test
        fun `|1,2,3|4,4,6|`() {
            val allEntries = listOf(
                    TestPageable("1", 1),
                    TestPageable("2", 2),
                    TestPageable("3", 3),
                    TestPageable("4", 4),
                    TestPageable("5", 4),
                    TestPageable("6", 6)
            )
            val firstPage = allEntries.getEntriesSinceIncluding(timestamp = 0, limit = 3)

            val page = Pagination.createPage(firstPage, null, 3)
            assertThat(page).isEqualTo(Page(
                    entities = listOf(
                            TestPageable("1", 1),
                            TestPageable("2", 2),
                            TestPageable("3", 3)
                    ),
                    currentToken = ContinuationToken(timestamp = 3, offset = 1, checksum = checksum("3"))
            ))

            val entriesSinceKey = allEntries.getEntriesSinceIncluding(timestamp = 3, limit = 5)
            val page2 = Pagination.createPage(entriesSinceKey, page.currentToken, 3)
            assertThat(page2).isEqualTo(Page(
                    entities = listOf(
                            TestPageable("4", 4),
                            TestPageable("5", 4),
                            TestPageable("6", 6)
                    ),
                    currentToken = ContinuationToken(timestamp = 6, offset = 1, checksum = checksum("6"))
            ))
        }

        @Test
        fun `|1,1,1|1,1,2|`() {
            val allEntries = listOf(
                    TestPageable("1", 1),
                    TestPageable("2", 1),
                    TestPageable("3", 1),
                    TestPageable("4", 1),
                    TestPageable("5", 1),
                    TestPageable("6", 2)
            )
            val firstPage = allEntries.getEntriesSinceIncluding(timestamp = 0, limit = 3)

            val page = Pagination.createPage(firstPage, null, 3)
            assertThat(page).isEqualTo(Page(
                    entities = listOf(
                            TestPageable("1", 1),
                            TestPageable("2", 1),
                            TestPageable("3", 1)
                    ),
                    currentToken = ContinuationToken(timestamp = 1, offset = 3, checksum = checksum("1", "2", "3"))
            ))

            val entriesSinceKey = allEntries.getEntriesSinceIncluding(timestamp = 1, limit = 6)
            val page2 = Pagination.createPage(entriesSinceKey, page.currentToken, 3)
            assertThat(page2).isEqualTo(Page(
                    entities = listOf(
                            TestPageable("4", 1),
                            TestPageable("5", 1),
                            TestPageable("6", 2)
                    ),
                    currentToken = ContinuationToken(timestamp = 2, offset = 1, checksum = checksum("6"))
            ))
        }

        private fun List<Pageable>.getEntriesSinceIncluding(timestamp: Int, limit: Int)
                = this.filter { it.getTimestamp() >= timestamp }.take(limit)
    }


    @Nested
    inner class `createToken` {
        @Test
        fun `only one entity with highest timestamp`() {
            val pageables = listOf(
                    TestPageable(1),
                    TestPageable(2),
                    TestPageable(3),
                    TestPageable(4)
            )
            val token = Pagination.createTokenForPage(pageables, pageables, 4)
            assertThat(token).isEqualTo(ContinuationToken(timestamp = 4, offset = 1, checksum = checksum("4")))
        }
        @Test
        fun `two entities with highest timestamp`() {
            val pageables = listOf(
                    TestPageable(1),
                    TestPageable(2),
                    TestPageable("3", 3),
                    TestPageable("4", 3)
            )
            val token = Pagination.createTokenForPage(pageables, pageables, 4)
            assertThat(token).isEqualTo(ContinuationToken(timestamp = 3, offset = 2, checksum = checksum("3", "4")))
        }
        @Test
        fun `all elements have same timestamp`() {
            val pageables = listOf(
                    TestPageable("1",1),
                    TestPageable("2",1),
                    TestPageable("3",1)
            )
            val token = Pagination.createTokenForPage(pageables, pageables, 3)
            assertThat(token).isEqualTo(ContinuationToken(timestamp = 1, offset = 3, checksum = checksum("1", "2", "3")))
        }
        @Test
        fun `one element list`() {
            val pageables = listOf(
                    TestPageable(1)
            )
            val token = Pagination.createTokenForPage(pageables, pageables, 1)
            assertThat(token).isEqualTo(ContinuationToken(timestamp = 1, offset = 1, checksum = checksum("1")))
        }
        @Test
        fun `empty list`() {
            val token = Pagination.createTokenForPage(listOf(), listOf(), 10)
            assertThat(token).isNull()
        }
        //TODO test varying pagesize!
    }

    @Nested
    inner class `calculateQueryAdvice`{
        @Test
        fun `no token provided`(){
            val advice = Pagination.calculateQueryAdvice(token = null, pageSize = 5)
            assertThat(advice).isEqualTo(QueryAdvice(timestamp = 0, limit = 5))
        }
        @Test
        fun `there was one element with timestamp 20 in the last page`(){
            val token = ContinuationToken(timestamp = 20, offset = 1, checksum = 999)
            val advice = Pagination.calculateQueryAdvice(token, pageSize = 5)
            assertThat(advice).isEqualTo(QueryAdvice(timestamp = 20, limit = 6))
        }
        @Test
        fun `there were 3 elements with timestamp 20 in the last page`(){
            val token = ContinuationToken(timestamp = 20, offset = 3, checksum = 999)
            val advice = Pagination.calculateQueryAdvice(token, pageSize = 5)
            assertThat(advice).isEqualTo(QueryAdvice(timestamp = 20, limit = 8))
        }
    }

    @Nested
    inner class `getEntitiesWithHighestKey`{
        @Test
        fun `all have different keys`(){
            val pageables = listOf(
                    TestPageable(1),
                    TestPageable(2),
                    TestPageable(3)
            )
            val entities = Pagination.getEntitiesWithHighestTimestamp(pageables)
            assertThat(entities).containsExactly(TestPageable(3))
        }
        @Test
        fun `some with the same key`(){
            val pageables = listOf(
                    TestPageable(1),
                    TestPageable(2),
                    TestPageable("4",3),
                    TestPageable("5",3)
                    )
            val entities = Pagination.getEntitiesWithHighestTimestamp(pageables)
            assertThat(entities).containsExactly(TestPageable("4",3), TestPageable("5",3))
        }
        @Test
        fun `all with the same key`(){
            val pageables = listOf(
                    TestPageable("1",1),
                    TestPageable("2",1),
                    TestPageable("3",1)
            )
            val entities = Pagination.getEntitiesWithHighestTimestamp(pageables)
            assertThat(entities).containsExactly(TestPageable("1",1), TestPageable("2",1), TestPageable("3",1))
        }
        @Test
        fun `empty list`(){
            val entities = Pagination.getEntitiesWithHighestTimestamp(listOf())
            assertThat(entities).isEmpty()
        }
        @Test
        fun `only one element`(){
            val pageables = listOf(TestPageable(1))
            val entities = Pagination.getEntitiesWithHighestTimestamp(pageables)
            assertThat(entities).containsExactly(TestPageable("1",1))
        }
    }
}

private fun checksum(vararg ids: String): Long{
    val hash = CRC32()
    hash.update(ids.joinToString("_").toByteArray())
    return hash.value
}

data class TestPageable(
        private val id: String,
        private val timestamp: Long
): Pageable {
    constructor(timestamp: Long): this(timestamp.toString(), timestamp)
    override fun getID() = id
    override fun getTimestamp() = timestamp
}

================================================
FILE: continuation-token/demo-kotlin/.gitignore
================================================
target/
!.mvn/wrapper/maven-wrapper.jar
.idea/
*.iml
dependency-reduced-pom.xml

================================================
FILE: continuation-token/demo-kotlin/.mvn/wrapper/maven-wrapper.properties
================================================
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.2/apache-maven-3.5.2-bin.zip


================================================
FILE: continuation-token/demo-kotlin/mvnw
================================================
#!/bin/sh
# ----------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
# ----------------------------------------------------------------------------

# ----------------------------------------------------------------------------
# Maven2 Start Up Batch script
#
# Required ENV vars:
# ------------------
#   JAVA_HOME - location of a JDK home dir
#
# Optional ENV vars
# -----------------
#   M2_HOME - location of maven2's installed home dir
#   MAVEN_OPTS - parameters passed to the Java VM when running Maven
#     e.g. to debug Maven itself, use
#       set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
#   MAVEN_SKIP_RC - flag to disable loading of mavenrc files
# ----------------------------------------------------------------------------

if [ -z "$MAVEN_SKIP_RC" ] ; then

  if [ -f /etc/mavenrc ] ; then
    . /etc/mavenrc
  fi

  if [ -f "$HOME/.mavenrc" ] ; then
    . "$HOME/.mavenrc"
  fi

fi

# OS specific support.  $var _must_ be set to either true or false.
cygwin=false;
darwin=false;
mingw=false
case "`uname`" in
  CYGWIN*) cygwin=true ;;
  MINGW*) mingw=true;;
  Darwin*) darwin=true
    # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
    # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
    if [ -z "$JAVA_HOME" ]; then
      if [ -x "/usr/libexec/java_home" ]; then
        export JAVA_HOME="`/usr/libexec/java_home`"
      else
        export JAVA_HOME="/Library/Java/Home"
      fi
    fi
    ;;
esac

if [ -z "$JAVA_HOME" ] ; then
  if [ -r /etc/gentoo-release ] ; then
    JAVA_HOME=`java-config --jre-home`
  fi
fi

if [ -z "$M2_HOME" ] ; then
  ## resolve links - $0 may be a link to maven's home
  PRG="$0"

  # need this for relative symlinks
  while [ -h "$PRG" ] ; do
    ls=`ls -ld "$PRG"`
    link=`expr "$ls" : '.*-> \(.*\)$'`
    if expr "$link" : '/.*' > /dev/null; then
      PRG="$link"
    else
      PRG="`dirname "$PRG"`/$link"
    fi
  done

  saveddir=`pwd`

  M2_HOME=`dirname "$PRG"`/..

  # make it fully qualified
  M2_HOME=`cd "$M2_HOME" && pwd`

  cd "$saveddir"
  # echo Using m2 at $M2_HOME
fi

# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
  [ -n "$M2_HOME" ] &&
    M2_HOME=`cygpath --unix "$M2_HOME"`
  [ -n "$JAVA_HOME" ] &&
    JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
  [ -n "$CLASSPATH" ] &&
    CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi

# For Migwn, ensure paths are in UNIX format before anything is touched
if $mingw ; then
  [ -n "$M2_HOME" ] &&
    M2_HOME="`(cd "$M2_HOME"; pwd)`"
  [ -n "$JAVA_HOME" ] &&
    JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
  # TODO classpath?
fi

if [ -z "$JAVA_HOME" ]; then
  javaExecutable="`which javac`"
  if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
    # readlink(1) is not available as standard on Solaris 10.
    readLink=`which readlink`
    if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
      if $darwin ; then
        javaHome="`dirname \"$javaExecutable\"`"
        javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
      else
        javaExecutable="`readlink -f \"$javaExecutable\"`"
      fi
      javaHome="`dirname \"$javaExecutable\"`"
      javaHome=`expr "$javaHome" : '\(.*\)/bin'`
      JAVA_HOME="$javaHome"
      export JAVA_HOME
    fi
  fi
fi

if [ -z "$JAVACMD" ] ; then
  if [ -n "$JAVA_HOME"  ] ; then
    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
      # IBM's JDK on AIX uses strange locations for the executables
      JAVACMD="$JAVA_HOME/jre/sh/java"
    else
      JAVACMD="$JAVA_HOME/bin/java"
    fi
  else
    JAVACMD="`which java`"
  fi
fi

if [ ! -x "$JAVACMD" ] ; then
  echo "Error: JAVA_HOME is not defined correctly." >&2
  echo "  We cannot execute $JAVACMD" >&2
  exit 1
fi

if [ -z "$JAVA_HOME" ] ; then
  echo "Warning: JAVA_HOME environment variable is not set."
fi

CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher

# traverses directory structure from process work directory to filesystem root
# first directory with .mvn subdirectory is considered project base directory
find_maven_basedir() {

  if [ -z "$1" ]
  then
    echo "Path not specified to find_maven_basedir"
    return 1
  fi

  basedir="$1"
  wdir="$1"
  while [ "$wdir" != '/' ] ; do
    if [ -d "$wdir"/.mvn ] ; then
      basedir=$wdir
      break
    fi
    # workaround for JBEAP-8937 (on Solaris 10/Sparc)
    if [ -d "${wdir}" ]; then
      wdir=`cd "$wdir/.."; pwd`
    fi
    # end of workaround
  done
  echo "${basedir}"
}

# concatenates all lines of a file
concat_lines() {
  if [ -f "$1" ]; then
    echo "$(tr -s '\n' ' ' < "$1")"
  fi
}

BASE_DIR=`find_maven_basedir "$(pwd)"`
if [ -z "$BASE_DIR" ]; then
  exit 1;
fi

export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
echo $MAVEN_PROJECTBASEDIR
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"

# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
  [ -n "$M2_HOME" ] &&
    M2_HOME=`cygpath --path --windows "$M2_HOME"`
  [ -n "$JAVA_HOME" ] &&
    JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
  [ -n "$CLASSPATH" ] &&
    CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
  [ -n "$MAVEN_PROJECTBASEDIR" ] &&
    MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
fi

WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain

exec "$JAVACMD" \
  $MAVEN_OPTS \
  -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
  "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
  ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"


================================================
FILE: continuation-token/demo-kotlin/mvnw.cmd
================================================
@REM ----------------------------------------------------------------------------
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements.  See the NOTICE file
@REM distributed with this work for additional information
@REM regarding copyright ownership.  The ASF licenses this file
@REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance
@REM with the License.  You may obtain a copy of the License at
@REM
@REM    http://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing,
@REM software distributed under the License is distributed on an
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM KIND, either express or implied.  See the License for the
@REM specific language governing permissions and limitations
@REM under the License.
@REM ----------------------------------------------------------------------------

@REM ----------------------------------------------------------------------------
@REM Maven2 Start Up Batch script
@REM
@REM Required ENV vars:
@REM JAVA_HOME - location of a JDK home dir
@REM
@REM Optional ENV vars
@REM M2_HOME - location of maven2's installed home dir
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
@REM     e.g. to debug Maven itself, use
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
@REM ----------------------------------------------------------------------------

@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@echo off
@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
@if "%MAVEN_BATCH_ECHO%" == "on"  echo %MAVEN_BATCH_ECHO%

@REM set %HOME% to equivalent of $HOME
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")

@REM Execute a user defined script before this one
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
:skipRcPre

@setlocal

set ERROR_CODE=0

@REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal

@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome

echo.
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error

:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init

echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error

@REM ==== END VALIDATION ====

:init

@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found.

set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir

set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR%
:findBaseDir
IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD%
goto findBaseDir

:baseDirFound
set MAVEN_PROJECTBASEDIR=%WDIR%
cd "%EXEC_DIR%"
goto endDetectBaseDir

:baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%"

:endDetectBaseDir

IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig

@setlocal EnableExtensions EnableDelayedExpansion
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%

:endReadAdditionalConfig

SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"

set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain

%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
if ERRORLEVEL 1 goto error
goto end

:error
set ERROR_CODE=1

:end
@endlocal & set ERROR_CODE=%ERROR_CODE%

if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
@REM check for post script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
:skipRcPost

@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
if "%MAVEN_BATCH_PAUSE%" == "on" pause

if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%

exit /B %ERROR_CODE%


================================================
FILE: continuation-token/demo-kotlin/pom.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <groupId>de.philipphauer.blog</groupId>
    <artifactId>demo-kotlin</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <kotlin.version>1.1.60</kotlin.version>
        <junit5.version>5.0.2</junit5.version>
        <http4k.version>3.0.1</http4k.version>
        <continuation-token.version>1.0.0-SNAPSHOT</continuation-token.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>de.philipphauer.blog</groupId>
            <artifactId>continuation-token</artifactId>
            <version>${continuation-token.version}</version>
        </dependency>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-stdlib</artifactId>
            <version>${kotlin.version}</version>
        </dependency>
        <dependency>
            <groupId>org.http4k</groupId>
            <artifactId>http4k-core</artifactId>
            <version>${http4k.version}</version>
        </dependency>
        <dependency>
            <groupId>org.http4k</groupId>
            <artifactId>http4k-server-jetty</artifactId>
            <version>${http4k.version}</version>
        </dependency>
        <dependency>
            <groupId>org.http4k</groupId>
            <artifactId>http4k-format-jackson</artifactId>
            <version>${http4k.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <version>5.0.1.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <version>1.4.196</version>
        </dependency>


        <!-- test -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>${junit5.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <version>3.8.0</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <sourceDirectory>src/main/kotlin</sourceDirectory>
        <testSourceDirectory>src/test/kotlin</testSourceDirectory>

        <plugins>
            <plugin>
                <groupId>org.jetbrains.kotlin</groupId>
                <artifactId>kotlin-maven-plugin</artifactId>
                <version>${kotlin.version}</version>
                <executions>
                    <execution>
                        <id>compile</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>test-compile</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>test-compile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.19</version>
                <dependencies>
                    <dependency>
                        <groupId>org.junit.platform</groupId>
                        <artifactId>junit-platform-surefire-provider</artifactId>
                        <version>1.0.2</version>
                    </dependency>
                    <dependency>
                        <groupId>org.junit.jupiter</groupId>
                        <artifactId>junit-jupiter-engine</artifactId>
                        <version>${junit5.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.1.0</version>
                <configuration>
                    <transformers>
                        <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                            <mainClass>de.philipphauer.blog.MainKt</mainClass>
                        </transformer>
                    </transformers>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>


================================================
FILE: continuation-token/demo-kotlin/src/main/kotlin/de/philipphauer/blog/DesignDAO.kt
================================================
package de.philipphauer.blog

import de.philipphauer.blog.pagination.ContinuationToken
import de.philipphauer.blog.pagination.Pagination
import org.springframework.jdbc.core.JdbcTemplate
import java.sql.ResultSet
import javax.sql.DataSource


class DesignDAO(dataSource: DataSource){

    private val template = JdbcTemplate(dataSource)

    fun getDesigns(token: ContinuationToken?, pageSize: Int): DesignPageEntity {
        val queryAdvice = Pagination.calculateQueryAdvice(token, pageSize)
        val sql = """SELECT * FROM designs
            WHERE UNIX_TIMESTAMP(dateModified) >= ${queryAdvice.timestamp}
            ORDER BY dateModified asc, id asc
            LIMIT ${queryAdvice.limit};"""
        val designs = template.query(sql, this::mapToDesign)
        val nextPage = Pagination.createPage(designs, token, pageSize)
        return DesignPageEntity(nextPage.entities as List<DesignEntity>, nextPage.currentToken)
    }

    private fun mapToDesign(rs: ResultSet, rowNum: Int) = DesignEntity(
            id = rs.getString("id"),
            title = rs.getString("title"),
            imageUrl = rs.getString("imageUrl"),
            dateModified = rs.getTimestamp("dateModified").toInstant()
    )
}

data class DesignPageEntity(
        val designs: List<DesignEntity>,
        val token: ContinuationToken?
)


================================================
FILE: continuation-token/demo-kotlin/src/main/kotlin/de/philipphauer/blog/DesignEntity.kt
================================================
package de.philipphauer.blog

import de.philipphauer.blog.pagination.Pageable
import java.time.Instant

data class DesignEntity(
        val id: String,
        val title: String,
        val imageUrl: String,
        val dateModified: Instant
): Pageable {
    override fun getID() = id
    override fun getTimestamp() = dateModified.epochSecond
}

================================================
FILE: continuation-token/demo-kotlin/src/main/kotlin/de/philipphauer/blog/DesignResource.kt
================================================
package de.philipphauer.blog

import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import de.philipphauer.blog.pagination.ContinuationTokenParser
import org.http4k.core.Request
import org.http4k.core.Response
import org.http4k.core.Status

class DesignResource(val dao: DesignDAO) {

    //TODO no next page on last page
    //TODO checksum

    fun getDesigns(request: Request): Response {
        val token = request.query("continue")?.let {ContinuationTokenParser.parse(it)}
        val pageSize = request.query("pageSize")?.toInt() ?: 100
        val daoResult = dao.getDesigns(token, pageSize)
        val dto = PageDTO(
                results = daoResult.designs.map(::mapToDTO),
                nextPage = if (daoResult.token == null) null else "http://localhost:8000/designs?pageSize=$pageSize&continue=${daoResult.token}"
        )
        return Response(Status.OK)
                .header("Content-Type", "application/json;charset=UTF-8")
                .body(dto.toJson())
    }
}

private fun mapToDTO(entity: DesignEntity) = DesignDTO(
        id = entity.id,
        title = entity.title,
        imageUrl = entity.imageUrl,
        dateModified = entity.dateModified.epochSecond
)

data class DesignDTO(
        val id: String,
        val title: String,
        val imageUrl: String,
        val dateModified: Long
)
data class PageDTO(
        val results: List<DesignDTO>,
        val nextPage: String?
)

private val mapper = jacksonObjectMapper()
private fun Any.toJson() = mapper.writeValueAsString(this)



================================================
FILE: continuation-token/demo-kotlin/src/main/kotlin/de/philipphauer/blog/Main.kt
================================================
package de.philipphauer.blog

import de.philipphauer.blog.util.DesignCreator
import de.philipphauer.blog.util.FunctionsMySQL
import org.eclipse.jetty.server.NCSARequestLog
import org.eclipse.jetty.server.Server
import org.h2.jdbcx.JdbcDataSource
import org.http4k.core.Method
import org.http4k.routing.bind
import org.http4k.routing.routes
import org.http4k.server.Jetty
import org.http4k.server.asServer
import org.springframework.core.io.ClassPathResource
import org.springframework.jdbc.datasource.init.ScriptUtils

fun main(args: Array<String>) {
    val resource = bootstrapDesignResource()

    val routingHandler = routes(
            "/designs" bind Method.GET to resource::getDesigns
    )
    val jetty = Server(8000).apply {
        requestLog = NCSARequestLog()
    }
    val server = routingHandler.asServer(Jetty(jetty)).start()
    server.block()
}

private fun bootstrapDesignResource(): DesignResource {
    val dataSource = JdbcDataSource().apply {
        user = "sa"
        password = ""
        setURL("jdbc:h2:mem:access;MODE=MySQL;DB_CLOSE_DELAY=-1")
    }
    FunctionsMySQL.register(dataSource.connection)
    ScriptUtils.executeSqlScript(dataSource.connection,  ClassPathResource("create-designs-table.sql"))

    DesignCreator(dataSource).createDesigns(amount = 20)

    val dao = DesignDAO(dataSource)
    return DesignResource(dao)
}



================================================
FILE: continuation-token/demo-kotlin/src/main/kotlin/de/philipphauer/blog/util/DesignCreator.kt
================================================
package de.philipphauer.blog.util

import org.springframework.jdbc.core.JdbcTemplate
import java.time.Instant
import javax.sql.DataSource

class DesignCreator(dataSource: DataSource) {

    private val utilTemplate = JdbcTemplate(dataSource)

    fun createDesigns(amount: Int) {
        val now = Instant.now()
        val values = (1..amount).mapIndexed{ i, _ -> arrayOf(
                i,
                "Cat $i",
                "http://domain.de/cat$i.jpg",
                now.plusSeconds(i.toLong()).epochSecond
        ) }
        utilTemplate.batchUpdate("INSERT INTO designs (id, title, imageUrl, dateModified) VALUES (?, ?, ?, FROM_UNIXTIME(?))", values)
    }
}

================================================
FILE: continuation-token/demo-kotlin/src/main/kotlin/de/philipphauer/blog/util/FunctionsMySQL.kt
================================================
package de.philipphauer.blog.util

import org.h2.util.StringUtils
import java.sql.Connection
import java.sql.SQLException
import java.text.SimpleDateFormat
import java.util.Date
import java.util.Locale

/**
 * https://github.com/h2database/h2database/blob/master/h2/src/main/org/h2/mode/FunctionsMySQL.java
 * This class implements some MySQL-specific functions.
 *
 * @author Jason Brittain
 * @author Thomas Mueller
 */
object FunctionsMySQL {

    /**
     * The date format of a MySQL formatted date/time.
     * Example: 2008-09-25 08:40:59
     */
    private val DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss"

    /**
     * Format replacements for MySQL date formats.
     * See
     * http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-format
     */
    private val FORMAT_REPLACE = arrayOf("%a", "EEE", "%b", "MMM", "%c", "MM", "%d", "dd", "%e", "d", "%H", "HH", "%h", "hh", "%I", "hh", "%i", "mm", "%j", "DDD", "%k", "H", "%l", "h", "%M", "MMMM", "%m", "MM", "%p", "a", "%r", "hh:mm:ss a", "%S", "ss", "%s", "ss", "%T", "HH:mm:ss", "%W", "EEEE", "%w", "F", "%Y", "yyyy", "%y", "yy", "%%", "%")

    /**
     * Register the functionality in the database.
     * Nothing happens if the functions are already registered.
     *
     * @param conn the connection
     */
    @Throws(SQLException::class)
    fun register(conn: Connection) {
        val init = arrayOf("UNIX_TIMESTAMP", "unixTimestamp", "FROM_UNIXTIME", "fromUnixTime", "DATE", "date")
        val stat = conn.createStatement()
        var i = 0
        while (i < init.size) {
            val alias = init[i]
            val method = init[i + 1]
            stat.execute(
                    "CREATE ALIAS IF NOT EXISTS " + alias +
                            " FOR \"" + FunctionsMySQL::class.java!!.name + "." + method + "\"")
            i += 2
        }
    }

    /**
     * Get the seconds since 1970-01-01 00:00:00 UTC.
     * See
     * http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_unix-timestamp
     *
     * @return the current timestamp in seconds (not milliseconds).
     */
    @JvmStatic
    fun unixTimestamp(): Int {
        return (System.currentTimeMillis() / 1000L).toInt()
    }

    /**
     * Get the seconds since 1970-01-01 00:00:00 UTC of the given timestamp.
     * See
     * http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_unix-timestamp
     *
     * @param timestamp the timestamp
     * @return the current timestamp in seconds (not milliseconds).
     */
    @JvmStatic
    fun unixTimestamp(timestamp: java.sql.Timestamp): Int {
        return (timestamp.time / 1000L).toInt()
    }

    /**
     * See
     * http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_from-unixtime
     *
     * @param seconds The current timestamp in seconds.
     * @return a formatted date/time String in the format "yyyy-MM-dd HH:mm:ss".
     */
    @JvmStatic
    fun fromUnixTime(seconds: Int): String {
        val formatter = SimpleDateFormat(DATE_TIME_FORMAT,
                Locale.ENGLISH)
        return formatter.format(Date(seconds * 1000L))
    }

    /**
     * See
     * http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_from-unixtime
     *
     * @param seconds The current timestamp in seconds.
     * @param format The format of the date/time String to return.
     * @return a formatted date/time String in the given format.
     */
    @JvmStatic
    fun fromUnixTime(seconds: Int, format: String): String {
        var format = format
        format = convertToSimpleDateFormat(format)
        val formatter = SimpleDateFormat(format, Locale.ENGLISH)
        return formatter.format(Date(seconds * 1000L))
    }

    private fun convertToSimpleDateFormat(format: String): String {
        var format = format
        val replace = FORMAT_REPLACE
        var i = 0
        while (i < replace.size) {
            format = StringUtils.replaceAll(format, replace[i], replace[i + 1])
            i += 2
        }
        return format
    }

    /**
     * See
     * http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date
     * This function is dependent on the exact formatting of the MySQL date/time
     * string.
     *
     * @param dateTime The date/time String from which to extract just the date
     * part.
     * @return the date part of the given date/time String argument.
     */
    @JvmStatic
    fun date(dateTime: String?): String? {
        if (dateTime == null) {
            return null
        }
        val index = dateTime!!.indexOf(' ')
        return if (index != -1) {
            dateTime!!.substring(0, index)
        } else dateTime
    }

}

================================================
FILE: continuation-token/demo-kotlin/src/main/resources/create-designs-table.sql
================================================
CREATE TABLE designs (
  id int AUTO_INCREMENT PRIMARY KEY,
  title varchar(100) NOT NULL,
  imageUrl varchar(100) NOT NULL,
  dateModified TIMESTAMP NOT NULL
);

================================================
FILE: continuation-token/demo-kotlin/src/test/kotlin/de/philipphauer/blog/DesignResourceTest.kt
================================================
package de.philipphauer.blog

import com.fasterxml.jackson.databind.DeserializationFeature
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import de.philipphauer.blog.util.DesignCreator
import de.philipphauer.blog.util.FunctionsMySQL
import org.h2.jdbcx.JdbcDataSource
import org.http4k.core.Method
import org.http4k.core.Request
import org.http4k.core.Response
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.TestInstance
import org.springframework.core.io.ClassPathResource
import org.springframework.jdbc.datasource.init.ScriptUtils

@TestInstance(TestInstance.Lifecycle.PER_CLASS)
internal class DesignResourceTest {

    private val resource = initDesignResource()
    private val creator = DesignCreator(dataSource)

    @Test
    fun `happy path`() {
        creator.createDesigns(amount = 10)
        val response = resource.getDesigns(Request(Method.GET, "/designs?pageSize=3"))

        println(response)
//        assertThat(response.toPageable().nextPage).contains("?continue=TODO")
    }

    //TODO test: find better test abstraction. e.g. PaginationTest
    // page with same key/ts
    // final page (amount < page size and = page size)
    // first element of next page: a) is first one with new key, b) not the same one
    // empty result
    // correct page size
    // no `nextPage` in last page
    // checksum usage


    private fun initDesignResource(): DesignResource {
        val dao = DesignDAO(dataSource)
        FunctionsMySQL.register(dataSource.connection)
        ScriptUtils.executeSqlScript(dataSource.connection,  ClassPathResource("create-designs-table.sql"))
        return DesignResource(dao)
    }
}

private val dataSource = JdbcDataSource().apply {
    user = "sa"
    password = ""
    setURL("jdbc:h2:mem:access;MODE=MySQL;DB_CLOSE_DELAY=-1")
}

private val mapper = jacksonObjectMapper().apply {
    configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
}
private fun Response.toPageable() = mapper.readValue(bodyString(), PageableResponse::class.java)

data class PageableResponse(
        val nextPage: String
)


================================================
FILE: development-productivity-vaadin-spring-boot/.gitignore
================================================
target/
!.mvn/wrapper/maven-wrapper.jar

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr

### NetBeans ###
nbproject/private/
build/
nbbuild/
dist/
nbdist/
.nb-gradle/

src/main/webapp/VAADIN/themes/mytheme/styles.css
src/main/webapp/VAADIN/themes/mytheme/styles.scss.cache

src/main/resources/VAADIN/themes/mytheme/styles.css

================================================
FILE: development-productivity-vaadin-spring-boot/.mvn/wrapper/maven-wrapper.properties
================================================
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.0/apache-maven-3.5.0-bin.zip


================================================
FILE: development-productivity-vaadin-spring-boot/Makefile
================================================
.PHONY: all watch

SHELL:=/bin/bash
BROWSERSYNC:=/usr/local/bin/browser-sync
all: watch

watch: $(BROWSERSYNC)
	browser-sync start --proxy 'localhost:8080' --files 'src/main/webapp/VAADIN/themes/mytheme/*.scss'

$(BROWSERSYNC):
	sudo npm install -g browser-sync


================================================
FILE: development-productivity-vaadin-spring-boot/README.md
================================================
An example application with some bootstrapping (spring security, JDBC auto configuration, h2 console, actuator endpoints, vaadin view discovery) to keep the application busy during startup. this way, we can better see the impact of our optimizations.

Build and Run

```bash
./mvnw clean package && java -jar target/development-productivity-vaadin-spring-boot*.jar
```

Search in created jar

```bash
./mvnw clean package
unzip -l target/development-productivity-vaadin-spring-boot*.jar | grep css 
```

Compile Vaadin Theme

```bash
./mvnw vaadin:compile-theme 
```

Check out `src/main/resources/application.properties`.

# Side Notes

Where to put `VAADIN/themes/mytheme`? `src/main/resources` or `src/main/webapp`? Vaadin's on-the-fly compilation works in both cases! (given: there is no `styles.css` (`src` and `target/classes`) and `production-mode=false`)

- `webapp`: sass changes are automatically detected and a recompilation is triggered. `styles.scss.cache` is created. no manual action required. But somehow, there is no `styles.css` in the built jar, although everything works fine.
- `resources`: after a change (in let's say `mytheme.scss`), you have to hit `Ctrl+Shift+F9` in IDEA. Now, the change is detected and recompilation is triggered. There is no `styles.scss.cache` at all.
  - Advantages: it's the [recommend location](https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-developing-web-applications.html#boot-features-spring-mvc-static-content) of spring boot! Moreover, you can find the generated styles.css in the jar!
  - Drawback: more uncomfortable theme editing.
  
If somebody can explain this behavior, please approach me!


================================================
FILE: development-productivity-vaadin-spring-boot/mvnw
================================================
#!/bin/sh
# ----------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
# ----------------------------------------------------------------------------

# ----------------------------------------------------------------------------
# Maven2 Start Up Batch script
#
# Required ENV vars:
# ------------------
#   JAVA_HOME - location of a JDK home dir
#
# Optional ENV vars
# -----------------
#   M2_HOME - location of maven2's installed home dir
#   MAVEN_OPTS - parameters passed to the Java VM when running Maven
#     e.g. to debug Maven itself, use
#       set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
#   MAVEN_SKIP_RC - flag to disable loading of mavenrc files
# ----------------------------------------------------------------------------

if [ -z "$MAVEN_SKIP_RC" ] ; then

  if [ -f /etc/mavenrc ] ; then
    . /etc/mavenrc
  fi

  if [ -f "$HOME/.mavenrc" ] ; then
    . "$HOME/.mavenrc"
  fi

fi

# OS specific support.  $var _must_ be set to either true or false.
cygwin=false;
darwin=false;
mingw=false
case "`uname`" in
  CYGWIN*) cygwin=true ;;
  MINGW*) mingw=true;;
  Darwin*) darwin=true
    # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
    # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
    if [ -z "$JAVA_HOME" ]; then
      if [ -x "/usr/libexec/java_home" ]; then
        export JAVA_HOME="`/usr/libexec/java_home`"
      else
        export JAVA_HOME="/Library/Java/Home"
      fi
    fi
    ;;
esac

if [ -z "$JAVA_HOME" ] ; then
  if [ -r /etc/gentoo-release ] ; then
    JAVA_HOME=`java-config --jre-home`
  fi
fi

if [ -z "$M2_HOME" ] ; then
  ## resolve links - $0 may be a link to maven's home
  PRG="$0"

  # need this for relative symlinks
  while [ -h "$PRG" ] ; do
    ls=`ls -ld "$PRG"`
    link=`expr "$ls" : '.*-> \(.*\)$'`
    if expr "$link" : '/.*' > /dev/null; then
      PRG="$link"
    else
      PRG="`dirname "$PRG"`/$link"
    fi
  done

  saveddir=`pwd`

  M2_HOME=`dirname "$PRG"`/..

  # make it fully qualified
  M2_HOME=`cd "$M2_HOME" && pwd`

  cd "$saveddir"
  # echo Using m2 at $M2_HOME
fi

# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
  [ -n "$M2_HOME" ] &&
    M2_HOME=`cygpath --unix "$M2_HOME"`
  [ -n "$JAVA_HOME" ] &&
    JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
  [ -n "$CLASSPATH" ] &&
    CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi

# For Migwn, ensure paths are in UNIX format before anything is touched
if $mingw ; then
  [ -n "$M2_HOME" ] &&
    M2_HOME="`(cd "$M2_HOME"; pwd)`"
  [ -n "$JAVA_HOME" ] &&
    JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
  # TODO classpath?
fi

if [ -z "$JAVA_HOME" ]; then
  javaExecutable="`which javac`"
  if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
    # readlink(1) is not available as standard on Solaris 10.
    readLink=`which readlink`
    if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
      if $darwin ; then
        javaHome="`dirname \"$javaExecutable\"`"
        javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
      else
        javaExecutable="`readlink -f \"$javaExecutable\"`"
      fi
      javaHome="`dirname \"$javaExecutable\"`"
      javaHome=`expr "$javaHome" : '\(.*\)/bin'`
      JAVA_HOME="$javaHome"
      export JAVA_HOME
    fi
  fi
fi

if [ -z "$JAVACMD" ] ; then
  if [ -n "$JAVA_HOME"  ] ; then
    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
      # IBM's JDK on AIX uses strange locations for the executables
      JAVACMD="$JAVA_HOME/jre/sh/java"
    else
      JAVACMD="$JAVA_HOME/bin/java"
    fi
  else
    JAVACMD="`which java`"
  fi
fi

if [ ! -x "$JAVACMD" ] ; then
  echo "Error: JAVA_HOME is not defined correctly." >&2
  echo "  We cannot execute $JAVACMD" >&2
  exit 1
fi

if [ -z "$JAVA_HOME" ] ; then
  echo "Warning: JAVA_HOME environment variable is not set."
fi

CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher

# traverses directory structure from process work directory to filesystem root
# first directory with .mvn subdirectory is considered project base directory
find_maven_basedir() {

  if [ -z "$1" ]
  then
    echo "Path not specified to find_maven_basedir"
    return 1
  fi

  basedir="$1"
  wdir="$1"
  while [ "$wdir" != '/' ] ; do
    if [ -d "$wdir"/.mvn ] ; then
      basedir=$wdir
      break
    fi
    # workaround for JBEAP-8937 (on Solaris 10/Sparc)
    if [ -d "${wdir}" ]; then
      wdir=`cd "$wdir/.."; pwd`
    fi
    # end of workaround
  done
  echo "${basedir}"
}

# concatenates all lines of a file
concat_lines() {
  if [ -f "$1" ]; then
    echo "$(tr -s '\n' ' ' < "$1")"
  fi
}

BASE_DIR=`find_maven_basedir "$(pwd)"`
if [ -z "$BASE_DIR" ]; then
  exit 1;
fi

export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
echo $MAVEN_PROJECTBASEDIR
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"

# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
  [ -n "$M2_HOME" ] &&
    M2_HOME=`cygpath --path --windows "$M2_HOME"`
  [ -n "$JAVA_HOME" ] &&
    JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
  [ -n "$CLASSPATH" ] &&
    CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
  [ -n "$MAVEN_PROJECTBASEDIR" ] &&
    MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
fi

WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain

exec "$JAVACMD" \
  $MAVEN_OPTS \
  -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
  "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
  ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"


================================================
FILE: development-productivity-vaadin-spring-boot/mvnw.cmd
================================================
@REM ----------------------------------------------------------------------------
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements.  See the NOTICE file
@REM distributed with this work for additional information
@REM regarding copyright ownership.  The ASF licenses this file
@REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance
@REM with the License.  You may obtain a copy of the License at
@REM
@REM    http://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing,
@REM software distributed under the License is distributed on an
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM KIND, either express or implied.  See the License for the
@REM specific language governing permissions and limitations
@REM under the License.
@REM ----------------------------------------------------------------------------

@REM ----------------------------------------------------------------------------
@REM Maven2 Start Up Batch script
@REM
@REM Required ENV vars:
@REM JAVA_HOME - location of a JDK home dir
@REM
@REM Optional ENV vars
@REM M2_HOME - location of maven2's installed home dir
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
@REM     e.g. to debug Maven itself, use
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
@REM ----------------------------------------------------------------------------

@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@echo off
@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
@if "%MAVEN_BATCH_ECHO%" == "on"  echo %MAVEN_BATCH_ECHO%

@REM set %HOME% to equivalent of $HOME
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")

@REM Execute a user defined script before this one
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
:skipRcPre

@setlocal

set ERROR_CODE=0

@REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal

@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome

echo.
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error

:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init

echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error

@REM ==== END VALIDATION ====

:init

@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found.

set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir

set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR%
:findBaseDir
IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD%
goto findBaseDir

:baseDirFound
set MAVEN_PROJECTBASEDIR=%WDIR%
cd "%EXEC_DIR%"
goto endDetectBaseDir

:baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%"

:endDetectBaseDir

IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig

@setlocal EnableExtensions EnableDelayedExpansion
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%

:endReadAdditionalConfig

SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"

set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain

%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
if ERRORLEVEL 1 goto error
goto end

:error
set ERROR_CODE=1

:end
@endlocal & set ERROR_CODE=%ERROR_CODE%

if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
@REM check for post script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
:skipRcPost

@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
if "%MAVEN_BATCH_PAUSE%" == "on" pause

if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%

exit /B %ERROR_CODE%


================================================
FILE: development-productivity-vaadin-spring-boot/pom.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<groupId>de.philipphauer.blog</groupId>
	<artifactId>development-productivity-vaadin-spring-boot</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<packaging>jar</packaging>

	<name>development-productivity-vaadin-spring-boot</name>
	<description>Demo project for Spring Boot</description>

	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>1.5.7.RELEASE</version>
		<relativePath/> <!-- lookup parent from repository -->
	</parent>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
		<java.version>1.8</java.version>
		<vaadin.version>8.1.0</vaadin.version>
	</properties>

	<dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-actuator</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-actuator-docs</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-mustache</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-security</artifactId>
		</dependency>
		<dependency>
			<groupId>com.vaadin</groupId>
			<artifactId>vaadin-spring-boot-starter</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-jdbc</artifactId>
		</dependency>
		<dependency>
			<groupId>com.h2database</groupId>
			<artifactId>h2</artifactId>
			<version>1.4.196</version>
		</dependency>

		<!-- restart and livereload are disabled in application.properties -->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-devtools</artifactId>
			<optional>true</optional>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.springframework.security</groupId>
			<artifactId>spring-security-test</artifactId>
			<scope>test</scope>
		</dependency>
	</dependencies>

	<dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>com.vaadin</groupId>
				<artifactId>vaadin-bom</artifactId>
				<version>${vaadin.version}</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>
		</dependencies>
	</dependencyManagement>

	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
			</plugin>
			<plugin>
				<groupId>com.vaadin</groupId>
				<artifactId>vaadin-maven-plugin</artifactId>
				<version>${vaadin.version}</version>
				<executions>
					<execution>
						<goals>
							<goal>resources</goal>
							<goal>update-theme</goal>
							<goal>compile-theme</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>


</project>


================================================
FILE: development-productivity-vaadin-spring-boot/src/main/java/de/philipphauer/blog/devproductivity/DevProductivityApplication.java
================================================
package de.philipphauer.blog.devproductivity;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class DevProductivityApplication {

	public static void main(String[] args) {
		SpringApplication.run(DevProductivityApplication.class, args);
	}
}


================================================
FILE: development-productivity-vaadin-spring-boot/src/main/java/de/philipphauer/blog/devproductivity/WebSecurityConfiguration.java
================================================
package de.philipphauer.blog.devproductivity;

import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

@Configuration
class WebSecurityConfiguration extends WebSecurityConfigurerAdapter {
    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.csrf().disable();
        http.authorizeRequests().anyRequest().permitAll();
        http.httpBasic().disable();
        http.formLogin().disable();
    }
}

================================================
FILE: development-productivity-vaadin-spring-boot/src/main/java/de/philipphauer/blog/devproductivity/model/Role.java
================================================
package de.philipphauer.blog.devproductivity.model;

public enum Role {
    GUEST, REGISTERED_USER
}


================================================
FILE: development-productivity-vaadin-spring-boot/src/main/java/de/philipphauer/blog/devproductivity/model/User.java
================================================
package de.philipphauer.blog.devproductivity.model;

public class User {
    private int id;
    private String firstName;
    private String lastName;
    private int age;
    private Role role;
    private boolean active;

    public int getId() {
        return id;
    }

    public User setId(int id) {
        this.id = id;
        return this;
    }

    public String getFirstName() {
        return firstName;
    }

    public User setFirstName(String firstName) {
        this.firstName = firstName;
        return this;
    }

    public String getLastName() {
        return lastName;
    }

    public User setLastName(String lastName) {
        this.lastName = lastName;
        return this;
    }

    public int getAge() {
        return age;
    }

    public User setAge(int age) {
        this.age = age;
        return this;
    }

    public Role getRole() {
        return role;
    }

    public User setRole(Role role) {
        this.role = role;
        return this;
    }

    public boolean isActive() {
        return active;
    }

    public User setActive(boolean active) {
        this.active = active;
        return this;
    }
}


================================================
FILE: development-productivity-vaadin-spring-boot/src/main/java/de/philipphauer/blog/devproductivity/rest/AdminResource.java
================================================
package de.philipphauer.blog.devproductivity.rest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

@Controller
public class AdminResource {

    @GetMapping("/")
    public String redirectToUI(){
        return "redirect:/ui";
    }

    @GetMapping("favicon.ico")
    public String favicon(){
        return "forward:/VAADIN/themes/sqljunkie/favicon.ico";
    }

    @GetMapping("/customResource")
    public String customResource(){
        return "Hi!";
    }
}


================================================
FILE: development-productivity-vaadin-spring-boot/src/main/java/de/philipphauer/blog/devproductivity/ui/MyAppUI.java
================================================
package de.philipphauer.blog.devproductivity.ui;

import com.vaadin.annotations.Theme;
import com.vaadin.server.VaadinRequest;
import com.vaadin.spring.annotation.SpringUI;
import com.vaadin.ui.Grid;
import com.vaadin.ui.Label;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.themes.ValoTheme;
import de.philipphauer.blog.devproductivity.model.Role;
import de.philipphauer.blog.devproductivity.model.User;

import java.util.List;
import java.util.Random;
import java.util.stream.Collectors;
import java.util.stream.Stream;

@SpringUI(path = "")
@Theme("mytheme")
public class MyAppUI extends UI {

    private Grid<User> table = new Grid<>(User.class);
    private Label heading = new Label("Development Productivity Demo");

    @Override
    protected void init(VaadinRequest vaadinRequest) {
        getPage().setTitle("Development Productivity Demo");

        table.setSizeFull();
        table.setItems(generateDummyUsers());

        heading.addStyleName(ValoTheme.LABEL_H1);

        VerticalLayout layout = new VerticalLayout();
        layout.addComponent(heading);
        layout.addComponentsAndExpand(table);
        setContent(layout);

        System.out.println("Session Object ID:"+getSession().hashCode());
    }

    private List<User> generateDummyUsers() {
        Random random = new Random();
        return Stream.generate(() -> random.nextInt(9999))
                .limit(50)
                .map(uuid -> new User()
                        .setId(uuid)
                        .setFirstName("Paul")
                        .setLastName("Stark")
                        .setActive(true)
                        .setRole(Role.REGISTERED_USER)
                        .setActive(true))
                .collect(Collectors.toList());
    }
}


================================================
FILE: development-productivity-vaadin-spring-boot/src/main/resources/application.properties
================================================
# but I prefer to control this via program arguments in my IDE's run configuration
vaadin.servlet.production-mode=false

# https://docs.spring.io/spring-boot/docs/current/reference/html/using-boot-devtools.html
spring.devtools.restart.enabled=false
spring.devtools.livereload.enabled=false



# just some stuff to keep our application busy during startup:
spring.h2.console.enabled=true
spring.h2.console.path=/h2
spring.datasource.url=jdbc:h2:file:~/test
spring.datasource.username=sa
spring.datasource.password=
spring.datasource.driver-class-name=org.h2.Driver

# deactivate default favicon delivery. use my dedicated resource for this. this resources uses the favicon in the vaadin theme.
spring.mvc.favicon.enabled=false


================================================
FILE: development-productivity-vaadin-spring-boot/src/main/webapp/VAADIN/themes/mytheme/addons.scss
================================================
/* This file is automatically managed and will be overwritten from time to time. */
/* Do not manually edit this file. */

/* Import and include this mixin into your project theme to include the addon themes */
@mixin addons {
}



================================================
FILE: development-productivity-vaadin-spring-boot/src/main/webapp/VAADIN/themes/mytheme/mytheme.scss
================================================
@import "../valo/valo.scss";

@mixin mytheme {
  @include valo;

  .monospace {
    font-family: monospace;
  }

  //div {
  //  background-color: blue;
  //}
}

================================================
FILE: development-productivity-vaadin-spring-boot/src/main/webapp/VAADIN/themes/mytheme/styles.scss
================================================
@import "addons";
@import "mytheme";

.mytheme {
  @include addons;
  @include mytheme;
}

================================================
FILE: dont-use-in-memory-databases-tests/db-container-managed-by-gradle/.gitignore
================================================
.gradle/
.idea/
out/
build/
*.iml

================================================
FILE: dont-use-in-memory-databases-tests/db-container-managed-by-gradle/build.gradle
================================================
plugins {
    id "com.chrisgahlert.gradle-dcompose-plugin" version "0.9.1"
    id 'org.springframework.boot' version '1.4.2.RELEASE'
}

apply plugin: 'java'

group 'de.philipphauer.blog'
version '1.0-SNAPSHOT'
sourceCompatibility = 1.8

repositories {
    mavenCentral()
}

dependencies {
    compile 'org.springframework.boot:spring-boot-starter-jdbc'
    compile 'mysql:mysql-connector-java:6.0.5'
    testCompile group: 'junit', name: 'junit', version: '4.12'
}

def mysqlTestPort = 3306
def mysqlTestPw = 'root'

dcompose {
    database {
        image = 'mysql:5.5.53'
        portBindings = ["$mysqlTestPort:3306"]
        env = ["MYSQL_ROOT_PASSWORD=$mysqlTestPw"]
    }
}

test {
    dependsOn startDatabaseContainer
    finalizedBy stopDatabaseContainer
    doFirst {
        systemProperty 'mysql.port', mysqlTestPort
        systemProperty 'mysql.pw', mysqlTestPw
    }
}


================================================
FILE: dont-use-in-memory-databases-tests/db-container-managed-by-gradle/docker-compose.yml
================================================
version: '2'
services:
  mysql:
    image: mysql:5.5.53
    ports:
      - "3306:3306"
    environment:
      MYSQL_ROOT_PASSWORD: "root"
      MYSQL_DATABASE: "testdb"


================================================
FILE: dont-use-in-memory-databases-tests/db-container-managed-by-gradle/gradle/wrapper/gradle-wrapper.properties
================================================
#Fri Aug 18 18:26:51 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip


================================================
FILE: dont-use-in-memory-databases-tests/db-container-managed-by-gradle/gradlew
================================================
#!/usr/bin/env sh

##############################################################################
##
##  Gradle start up script for UN*X
##
##############################################################################

# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
    ls=`ls -ld "$PRG"`
    link=`expr "$ls" : '.*-> \(.*\)$'`
    if expr "$link" : '/.*' > /dev/null; then
        PRG="$link"
    else
        PRG=`dirname "$PRG"`"/$link"
    fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null

APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"

warn () {
    echo "$*"
}

die () {
    echo
    echo "$*"
    echo
    exit 1
}

# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
  CYGWIN* )
    cygwin=true
    ;;
  Darwin* )
    darwin=true
    ;;
  MINGW* )
    msys=true
    ;;
  NONSTOP* )
    nonstop=true
    ;;
esac

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar

# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
        # IBM's JDK on AIX uses strange locations for the executables
        JAVACMD="$JAVA_HOME/jre/sh/java"
    else
        JAVACMD="$JAVA_HOME/bin/java"
    fi
    if [ ! -x "$JAVACMD" ] ; then
        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
    fi
else
    JAVACMD="java"
    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi

# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
    MAX_FD_LIMIT=`ulimit -H -n`
    if [ $? -eq 0 ] ; then
        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
            MAX_FD="$MAX_FD_LIMIT"
        fi
        ulimit -n $MAX_FD
        if [ $? -ne 0 ] ; then
            warn "Could not set maximum file descriptor limit: $MAX_FD"
        fi
    else
        warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
    fi
fi

# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
    GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi

# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
    APP_HOME=`cygpath --path --mixed "$APP_HOME"`
    CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
    JAVACMD=`cygpath --unix "$JAVACMD"`

    # We build the pattern for arguments to be converted via cygpath
    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
    SEP=""
    for dir in $ROOTDIRSRAW ; do
        ROOTDIRS="$ROOTDIRS$SEP$dir"
        SEP="|"
    done
    OURCYGPATTERN="(^($ROOTDIRS))"
    # Add a user-defined pattern to the cygpath arguments
    if [ "$GRADLE_CYGPATTERN" != "" ] ; then
        OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
    fi
    # Now convert the arguments - kludge to limit ourselves to /bin/sh
    i=0
    for arg in "$@" ; do
        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option

        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition
            eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
        else
            eval `echo args$i`="\"$arg\""
        fi
        i=$((i+1))
    done
    case $i in
        (0) set -- ;;
        (1) set -- "$args0" ;;
        (2) set -- "$args0" "$args1" ;;
        (3) set -- "$args0" "$args1" "$args2" ;;
        (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
        (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
        (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
        (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
        (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
        (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
    esac
fi

# Escape application args
save () {
    for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
    echo " "
}
APP_ARGS=$(save "$@")

# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"

# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
  cd "$(dirname "$0")"
fi

exec "$JAVACMD" "$@"


================================================
FILE: dont-use-in-memory-databases-tests/db-container-managed-by-gradle/gradlew.bat
================================================
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem  Gradle startup script for Windows
@rem
@rem ##########################################################################

@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto init

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:init
@rem Get command-line arguments, handling Windows variants

if not "%OS%" == "Windows_NT" goto win9xME_args

:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2

:win9xME_args_slurp
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1

:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega


================================================
FILE: dont-use-in-memory-databases-tests/db-container-managed-by-gradle/settings.gradle
================================================
rootProject.name = 'db-container-managed-by-gradle'



================================================
FILE: dont-use-in-memory-databases-tests/db-container-managed-by-gradle/src/test/java/de/philipphauer/blog/MyTest.java
================================================
package de.philipphauer.blog;

import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.DefaultTransactionDefinition;

import javax.sql.DataSource;

public class MyTest {

    private static DataSource dataSource;

    @BeforeClass
    public static void init() throws InterruptedException{
        Thread.sleep(5_000); //wait for the docker container to start
        String port = System.getProperty("mysql.port", "3306");
        String pw = System.getProperty("mysql.pw", "root");
        String url = "jdbc:mysql://localhost:" + port + "?autoReconnect=true";
        System.out.println("MySQL URL: " + url +" with pw " + pw);
        dataSource = DataSourceBuilder.create()
                .url(url)
                .username("root")
                .password(pw)
                .driverClassName("com.mysql.cj.jdbc.Driver")
                .build();
    }

    @Test
    public void foo(){
        DataSourceTransactionManager txManager = new DataSourceTransactionManager(dataSource);
        JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
        TransactionStatus transaction = txManager.getTransaction(new DefaultTransactionDefinition());
        jdbcTemplate.execute("DROP SCHEMA IF EXISTS testdb"); //dcompose reuses container
        jdbcTemplate.execute("CREATE SCHEMA testdb");
        jdbcTemplate.execute("CREATE TABLE testdb.BAR (" +
                "id INT NOT NULL AUTO_INCREMENT PRIMARY KEY," +
                "name varchar(200)" +
                ");");
        txManager.commit(transaction);
    }
}


================================================
FILE: dont-use-in-memory-databases-tests/db-container-managed-by-maven/.gitignore
================================================
.idea/
target/

================================================
FILE: dont-use-in-memory-databases-tests/db-container-managed-by-maven/docker-compose.yml
================================================
version: '2'
services:
  mysql:
    image: mysql:5.5.53
    ports:
      - "3306:3306"
    environment:
      MYSQL_ROOT_PASSWORD: "root"
      MYSQL_DATABASE: "testdb"


================================================
FILE: dont-use-in-memory-databases-tests/db-container-managed-by-maven/pom.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>de.philipphauer.blog</groupId>
    <artifactId>db-container-managed-by-maven</artifactId>
    <version>1.0-SNAPSHOT</version>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.4.2.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <mysql.test.port>3306</mysql.test.port>
        <mysql.test.pw>root</mysql.test.pw>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jdbc</artifactId>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>6.0.5</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.5.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>io.fabric8</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <version>0.21.0</version>
                <configuration>
                    <images>
                        <image>
                            <name>mysql:5.5.53</name>
                            <alias>mysql</alias>
                            <run>
                                <env>
                                    <MYSQL_ROOT_PASSWORD>${mysql.test.pw}</MYSQL_ROOT_PASSWORD>
                                </env>
                                <ports>
                                    <port>${mysql.test.port}:3306</port>
                                </ports>
                                <wait>
                                    <!-- time based waiting is the only option, because TCP-based or log-based polling are not reliable.
                                    see https://github.com/fabric8io/docker-maven-plugin/issues/328
                                    Alternatively we can wait log- or tcp-based and try to connect for a while in the test code -->
                                    <time>8000</time>
                                </wait>
                            </run>
                        </image>
                    </images>
                </configuration>
                <executions>
                    <execution>
                        <id>start</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>start</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>stop</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>stop</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>2.18.1</version>
                <configuration>
                    <includes>
                        <include>**/*IT.*</include>
                    </includes>
                    <systemPropertyVariables>
                        <mysql.port>${mysql.test.port}</mysql.port>
                        <mysql.pw>${mysql.test.pw}</mysql.pw>
                    </systemPropertyVariables>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.18.1</version>
                <configuration>
                    <excludes>
                        <exclude>**/*IT.*</exclude>
                    </excludes>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

================================================
FILE: dont-use-in-memory-databases-tests/db-container-managed-by-maven/src/test/java/de/philipphauer/blog/MyIT.java
================================================
package de.philipphauer.blog;

import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.DefaultTransactionDefinition;

import javax.sql.DataSource;

public class MyIT {

    private static DataSource dataSource;

    @BeforeClass
    public static void init() throws InterruptedException{
        // the maven-docker-plugin already waits. no need to do it here.
        String port = System.getProperty("mysql.port", "3306");
        String pw = System.getProperty("mysql.pw", "root");
        String url = "jdbc:mysql://localhost:" + port + "?autoReconnect=true";
        System.out.println("MySQL URL: " + url +" with pw " + pw);
        dataSource = DataSourceBuilder.create()
                .url(url)
                .username("root")
                .password(pw)
                .driverClassName("com.mysql.cj.jdbc.Driver")
                .build();
    }

    @Test
    public void foo(){
        DataSourceTransactionManager txManager = new DataSourceTransactionManager(dataSource);
        JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
        TransactionStatus transaction = txManager.getTransaction(new DefaultTransactionDefinition());
        jdbcTemplate.execute("DROP SCHEMA IF EXISTS testdb");
        jdbcTemplate.execute("CREATE SCHEMA testdb");
        jdbcTemplate.execute("CREATE TABLE testdb.BAR (" +
                "id INT NOT NULL AUTO_INCREMENT PRIMARY KEY," +
                "name varchar(200)" +
                ");");
        txManager.commit(transaction);
    }
}


================================================
FILE: dont-use-in-memory-databases-tests/db-container-managed-by-the-test/.gitignore
================================================
.gradle/
.idea/
out/
build/
*.iml

================================================
FILE: dont-use-in-memory-databases-tests/db-container-managed-by-the-test/build.gradle
================================================
plugins {
    id 'org.springframework.boot' version '1.4.2.RELEASE'
}

apply plugin: 'java'

group 'de.philipphauer.blog'
version '1.0-SNAPSHOT'
sourceCompatibility = 1.8

repositories {
    mavenCentral()
}

dependencies {
    compile 'org.springframework.boot:spring-boot-starter-jdbc'
    compile 'mysql:mysql-connector-java:6.0.5'
    testCompile group: 'junit', name: 'junit', version: '4.12'
    testCompile('org.testcontainers:mysql:1.4.2')
}


================================================
FILE: dont-use-in-memory-databases-tests/db-container-managed-by-the-test/docker-compose.yml
================================================
version: '2'
services:
  mysql:
    image: mysql:5.5.53
    ports:
      - "3306:3306"
    environment:
      MYSQL_ROOT_PASSWORD: "root"
      MYSQL_DATABASE: "testdb"


================================================
FILE: dont-use-in-memory-databases-tests/db-container-managed-by-the-test/gradle/wrapper/gradle-wrapper.properties
================================================
#Fri Aug 18 18:26:51 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip


================================================
FILE: dont-use-in-memory-databases-tests/db-container-managed-by-the-test/gradlew
================================================
#!/usr/bin/env sh

##############################################################################
##
##  Gradle start up script for UN*X
##
##############################################################################

# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
    ls=`ls -ld "$PRG"`
    link=`expr "$ls" : '.*-> \(.*\)$'`
    if expr "$link" : '/.*' > /dev/null; then
        PRG="$link"
    else
        PRG=`dirname "$PRG"`"/$link"
    fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null

APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"

warn () {
    echo "$*"
}

die () {
    echo
    echo "$*"
    echo
    exit 1
}

# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
  CYGWIN* )
    cygwin=true
    ;;
  Darwin* )
    darwin=true
    ;;
  MINGW* )
    msys=true
    ;;
  NONSTOP* )
    nonstop=true
    ;;
esac

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar

# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
        # IBM's JDK on AIX uses strange locations for the executables
        JAVACMD="$JAVA_HOME/jre/sh/java"
    else
        JAVACMD="$JAVA_HOME/bin/java"
    fi
    if [ ! -x "$JAVACMD" ] ; then
        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
    fi
else
    JAVACMD="java"
    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi

# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
    MAX_FD_LIMIT=`ulimit -H -n`
    if [ $? -eq 0 ] ; then
        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
            MAX_FD="$MAX_FD_LIMIT"
        fi
        ulimit -n $MAX_FD
        if [ $? -ne 0 ] ; then
            warn "Could not set maximum file descriptor limit: $MAX_FD"
        fi
    else
        warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
    fi
fi

# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
    GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi

# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
    APP_HOME=`cygpath --path --mixed "$APP_HOME"`
    CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
    JAVACMD=`cygpath --unix "$JAVACMD"`

    # We build the pattern for arguments to be converted via cygpath
    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
    SEP=""
    for dir in $ROOTDIRSRAW ; do
        ROOTDIRS="$ROOTDIRS$SEP$dir"
        SEP="|"
    done
    OURCYGPATTERN="(^($ROOTDIRS))"
    # Add a user-defined pattern to the cygpath arguments
    if [ "$GRADLE_CYGPATTERN" != "" ] ; then
        OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
    fi
    # Now convert the arguments - kludge to limit ourselves to /bin/sh
    i=0
    for arg in "$@" ; do
        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option

        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition
            eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
        else
            eval `echo args$i`="\"$arg\""
        fi
        i=$((i+1))
    done
    case $i in
        (0) set -- ;;
        (1) set -- "$args0" ;;
        (2) set -- "$args0" "$args1" ;;
        (3) set -- "$args0" "$args1" "$args2" ;;
        (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
        (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
        (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
        (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
        (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
        (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
    esac
fi

# Escape application args
save () {
    for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
    echo " "
}
APP_ARGS=$(save "$@")

# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"

# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
  cd "$(dirname "$0")"
fi

exec "$JAVACMD" "$@"


================================================
FILE: dont-use-in-memory-databases-tests/db-container-managed-by-the-test/gradlew.bat
================================================
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem  Gradle startup script for Windows
@rem
@rem ##########################################################################

@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto init

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:init
@rem Get command-line arguments, handling Windows variants

if not "%OS%" == "Windows_NT" goto win9xME_args

:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2

:win9xME_args_slurp
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1

:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega


================================================
FILE: dont-use-in-memory-databases-tests/db-container-managed-by-the-test/settings.gradle
================================================
rootProject.name = 'db-container-managed-by-gradle'



================================================
FILE: dont-use-in-memory-databases-tests/db-container-managed-by-the-test/src/test/java/de/philipphauer/blog/MyTest.java
================================================
package de.philipphauer.blog;

import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.DefaultTransactionDefinition;
import org.testcontainers.containers.MySQLContainer;

import javax.sql.DataSource;

public class MyTest {

    private static DataSource dataSource;
    private static MySQLContainer mysql;

    @BeforeClass
    public static void init() throws InterruptedException{
        //You can also use the GenericContainer for arbitrary containers
        //But there are convenient classes for common databases.
        mysql = new MySQLContainer("mysql:5.5.53");
        mysql.start();
        dataSource = DataSourceBuilder.create()
                .url(mysql.getJdbcUrl())
                .username(mysql.getUsername())
                .password(mysql.getPassword())
                .driverClassName("com.mysql.cj.jdbc.Driver")
                .build();
    }

    @AfterClass
    public static void destroy(){
        mysql.close();
    }

    @Test
    public void foo(){
        DataSourceTransactionManager txManager = new DataSourceTransactionManager(dataSource);
        JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
        TransactionStatus transaction = txManager.getTransaction(new DefaultTransactionDefinition());
        jdbcTemplate.execute("CREATE TABLE BAR (" +
                "id INT NOT NULL AUTO_INCREMENT PRIMARY KEY," +
                "name varchar(200)" +
                ");");
        txManager.commit(transaction);
    }
}


================================================
FILE: framework-beats-generator/.gitignore
================================================
db

# Created by .ignore support plugin (hsz.mobi)
### Maven template
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
### Example user template template
### Example user template

# IntelliJ project files
.idea
*.iml
out
gen


================================================
FILE: framework-beats-generator/pom.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>de.philipphauer</groupId>
    <artifactId>framework-beats-generator</artifactId>
    <version>1.0-SNAPSHOT</version>

    <dependencies>
        <dependency>
            <groupId>org.mongojack</groupId>
            <artifactId>mongojack</artifactId>
            <version>2.5.1</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <version>1.4.190</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>5.0.6.Final</version>
        </dependency>
        <dependency>
            <groupId>javax.transaction</groupId>
            <artifactId>javax.transaction-api</artifactId>
            <version>1.2</version>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <version>3.2.0</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>com.github.joelittlejohn.embedmongo</groupId>
                <artifactId>embedmongo-maven-plugin</artifactId>
                <version>0.3.1</version>
                <configuration>
                    <version>3.2.0</version>
                    <bindIp>127.0.0.1</bindIp>
                    <wait>true</wait>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

================================================
FILE: framework-beats-generator/src/main/java/de/philipphauer/h2/H2WebConsole.java
================================================
package de.philipphauer.h2;

import org.h2.tools.Server;

import java.sql.SQLException;

public class H2WebConsole {

    public static void start() {
        try {
            Server server = Server.createWebServer(new String[]{}).start();
            System.out.println("H2 can be accessed in port: "+server.getPort());
            System.out.println("URL: jdbc:h2:./db/repository");
            System.out.println("Empty user and pw");
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }
}


================================================
FILE: framework-beats-generator/src/main/java/de/philipphauer/jpa/Article.java
================================================
package de.philipphauer.jpa;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;

@Entity
public class Article {

    @Id
    @GeneratedValue
    private int id;

    private String name;

    public Article(String name){
        this.name = name;
    }

    public Article(){
    }

    public String getName() {
        return name;
    }

    public int getId() {
        return id;
    }
}


================================================
FILE: framework-beats-generator/src/main/java/de/philipphauer/jpa/ArticleDAO.java
================================================
package de.philipphauer.jpa;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.persistence.Query;
import java.util.Collection;

public class ArticleDAO {

    private final EntityManager entityManager;

    public ArticleDAO() {
        EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory("myPersistenceUnit");
        this.entityManager = entityManagerFactory.createEntityManager();
    }

    public void save(Article article) {
        entityManager.getTransaction().begin();
        entityManager.persist(article);
        entityManager.getTransaction().commit();
    }

    public Collection<Article> findAll() {
        Query query = entityManager.createQuery("SELECT e FROM Article e");
        return (Collection<Article>) query.getResultList();
    }

    public void close(){
        entityManager.close();
    }
}


================================================
FILE: framework-beats-generator/src/main/java/de/philipphauer/mongojack/Product.java
================================================
package de.philipphauer.mongojack;

import org.mongojack.ObjectId;

public class Product {
    @ObjectId
    private String id;
    private String name;
    private int price;

    public Product(String name, int price) {
        this.name = name;
        this.price = price;
    }

    public String getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public int getPrice() {
        return price;
    }
}

================================================
FILE: framework-beats-generator/src/main/java/de/philipphauer/mongojack/ProductDAO.java
================================================
package de.philipphauer.mongojack;

import com.mongodb.DB;
import com.mongodb.DBCollection;
import com.mongodb.MongoClient;
import com.mongodb.ServerAddress;
import org.mongojack.JacksonDBCollection;

import java.net.UnknownHostException;

public class ProductDAO {

    public void save(Product product) throws UnknownHostException {
        MongoClient mongoClient = new MongoClient(new ServerAddress("localhost", 27017));
        DB db = mongoClient.getDB("test");
        DBCollection collection = db.getCollection("products");
        JacksonDBCollection<Product, String> productCollection = JacksonDBCollection.wrap(collection, Product.class,
                String.class);
        productCollection.insert(product);
        mongoClient.close();
    }
}


================================================
FILE: framework-beats-generator/src/main/resources/META-INF/persistence.xml
================================================
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
             version="2.0">
    <persistence-unit name="myPersistenceUnit" transaction-type="RESOURCE_LOCAL">
        <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
        <properties>
            <property name="connection.driver_class" value="org.h2.Driver"/>
            <property name="hibernate.connection.url" value="jdbc:h2:./db/repository"/>
            <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
            <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
            <property name="hibernate.show_sql" value="true" />
            <property name="javax.persistence.jdbc.user" value=""/>
            <property name="javax.persistence.jdbc.password" value=""/>
        </properties>
    </persistence-unit>
</persistence>

================================================
FILE: framework-beats-generator/src/test/java/de/philipphauer/jpa/ArticleDAOTest.java
================================================
package de.philipphauer.jpa;

import de.philipphauer.h2.H2WebConsole;
import org.junit.Test;

public class ArticleDAOTest {

    @Test
    public void saveAndLoad() throws Exception {
        ArticleDAO dao = new ArticleDAO();
        Article article = new Article("Car");
        dao.save(article);

//        Collection<Article> articles = dao.findAll();
//        Assertions.assertThat(articles).contains(article);

        System.out.println("Now you can take a look at the h2 web console...");
        H2WebConsole.start();
        Thread.sleep(40000);

    }
}

================================================
FILE: framework-beats-generator/src/test/java/de/philipphauer/jpa/H2Test.java
================================================
package de.philipphauer.jpa;

import org.junit.Test;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class H2Test {

    @Test
    public void connection() throws ClassNotFoundException, SQLException {
        Class.forName("org.h2.Driver");
        Connection conn = DriverManager.getConnection("jdbc:h2:~/test", "sa", "");
        conn.close();
    }
}


================================================
FILE: framework-beats-generator/src/test/java/de/philipphauer/mongojack/ProductDAOTest.java
================================================
package de.philipphauer.mongojack;

import org.junit.Test;

public class ProductDAOTest {

    @Test
    public void save() throws Exception {
        ProductDAO dao = new ProductDAO();
        dao.save(new Product("Lego Car", 100));
    }
}

================================================
FILE: framework-beats-generator/startMongoDBLocally.bat
================================================
rem local mongodb installation needed

echo "Creating dbpath"
mkdir \data\db\

echo "Starting MongoDB..."
start mongod 

echo "Starting MongoDB Client..."
start mongo

================================================
FILE: kotlin-examples/.gitignore
================================================
.idea/
target/
*.iml

================================================
FILE: kotlin-examples/pom.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>de.philipphauer.blog</groupId>
    <artifactId>kotlin-examples</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <kotlin.version>1.0.5-2</kotlin.version>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-stdlib</artifactId>
            <version>${kotlin.version}</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>kotlin-maven-plugin</artifactId>
                <groupId>org.jetbrains.kotlin</groupId>
                <version>${kotlin.version}</version>
                <executions>
                    <execution>
                        <id>compile</id>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                        <configuration>
                            <sourceDirs>
                                <sourceDir>${project.basedir}/src/main/kotlin</sourceDir>
                                <sourceDir>${project.basedir}/src/main/java</sourceDir>
                            </sourceDirs>
                        </configuration>
                    </execution>
                    <execution>
                        <id>test-compile</id>
                        <goals>
                            <goal>test-compile</goal>
                        </goals>
                        <configuration>
                            <sourceDirs>
                                <sourceDir>${project.basedir}/src/main/kotlin</sourceDir>
                                <sourceDir>${project.basedir}/src/main/java</sourceDir>
                            </sourceDirs>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.5.1</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
                <executions>
                    <!-- Replacing default-compile as it is treated specially by maven -->
                    <execution>
                        <id>default-compile</id>
                        <phase>none</phase>
                    </execution>
                    <!-- Replacing default-testCompile as it is treated specially by maven -->
                    <execution>
                        <id>default-testCompile</id>
                        <phase>none</phase>
                    </execution>
                    <execution>
                        <id>java-compile</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>java-test-compile</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>testCompile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>

================================================
FILE: kotlin-examples/src/main/java/javaVariant/1DefineAndMapBeans.java
================================================
package javaVariant;

import java.time.Instant;
import java.util.List;
import java.util.stream.Collectors;

//BlogEntity (received from persistence layer) map to BlogDTO (returned by our REST Service)
//Struct definition and mapping code are extremely verbose in java!
//Besides, null handling is cumbersome. Especially when it comes to nested objects that can be null.
//All values can be null. It's easy to run into NullPointerExceptions. This leads to error-prone code. And even if you add null-checks, it's easy to forget a check (because the compiler doesn't help you) and the code becomes very verbose.
//Argument lists are hard to read and error prone
class BlogEntity {
    private long id;
    private String name;
    private List<PostEntity> posts;

    //Praise my IDE for generating the constructor and getter boilerplate. Otherwise I would drive nuts.
    //Moreover, equals(), hashCode(), toString() are still missing!
    //AND you have to maintain these methods when field are added or removed.
    public BlogEntity(long id, String name, List<PostEntity> posts) {
        this.id = id;
        this.name = name;
        this.posts = posts;
    }

    public String getName() {
        return name;
    }

    public List<PostEntity> getPosts() {
        return posts;
    }

    public long getId() {
        return id;
    }
}

class PostEntity {
    private long id;
    private AuthorEntity author;
    private Instant date;
    private String text;
    private List<CommentEntity> comments;

    public PostEntity(long id, AuthorEntity author, Instant date, String text, List<CommentEntity> comments) {
        this.id = id;
        this.author = author;
        this.date = date;
        this.text = text;
        this.comments = comments;
    }

    public AuthorEntity getAuthor() {
        return author;
    }

    public Instant getDate() {
        return date;
    }

    public String getText() {
        return text;
    }

    public List<CommentEntity> getComments() {
        return comments;
    }

    public long getId() {
        return id;
    }
}

class AuthorEntity {
    private String name;
    private String email;

    public AuthorEntity(String name, String email) {
        this.name = name;
        this.email = email;
    }

    public String getName() {
        return name;
    }

    public String getEmail() {
        return email;
    }
}

class CommentEntity {
    private String text;
    private AuthorEntity author;
    private Instant date;

    public CommentEntity(String text, AuthorEntity author, Instant date) {
        this.text = text;
        this.author = author;
        this.date = date;
    }

    public String getText() {
        return text;
    }

    public AuthorEntity getAuthor() {
        return author;
    }

    public Instant getDate() {
        return date;
    }
}

class BlogDTO{
    private long id;
    private String name;
    private List<PostDTO> posts;

    public BlogDTO(long id, String name, List<PostDTO> posts) {
        this.id = id;
        this.name = name;
        this.posts = posts;
    }

    public String getName() {
        return name;
    }

    public List<PostDTO> getPosts() {
        return posts;
    }

    public long getId() {
        return id;
    }

}
class PostDTO{
    private long id;
    private String date;
    private String author;
    private String text;
    private String commentsHref;

    public PostDTO(long id, String date, String author, String text, String commentsHref) {
        this.id = id;
        this.date = date;
        this.author = author;
        this.text = text;
        this.commentsHref = commentsHref;
    }

    public String getAuthor() {
        return author;
    }

    public String getDate() {
        return date;
    }

    public String getText() {
        return text;
    }

    public String getCommentsHref() {
        return commentsHref;
    }

    public long getId() {
        return id;
    }
}

class Mapper {
    public List<BlogDTO> mapToBlogDTOs(List<BlogEntity> entities){
        //verbose stream api
        return entities.stream()
                .map(this::mapToBlogDTO)
                .collect(Collectors.toList());
    }
    private BlogDTO mapToBlogDTO(BlogEntity entity){
        return new BlogDTO(
                entity.getId(),
                entity.getName(),
                mapToPostDTO(entity.getPosts())
        );
    }

    private List<PostDTO> mapToPostDTO(List<PostEntity> posts) {
        //what if posts is null?! very unsafe code!
        return posts.stream()
                .map(this::mapToPostDTO)
                .collect(Collectors.toList());
    }

    private PostDTO mapToPostDTO(PostEntity post) {
        //what if author, date, text or comments are null?! error-prone code!
        //easy to mess up parameter order (most of them are strings). hard to understand meaning of last parameter.
        return new PostDTO(
                post.getId(),
                post.getDate() != null ? post.getDate().getEpochSecond()+ "" : null, //hard to read. easy to forget null check.
                getNameOrDefault(post.getAuthor()),
                post.getText(),
                "posts/" + post.getId() + "/comments"
        );
    }

    //null checks bloat code. very verbose. hard to read.
    private String getNameOrDefault(AuthorEntity author) {
        if (author != null){
            String name = author.getName();
            if (name != null){
                return name;
            }
        }
        return "Anonymous";
    }
}


================================================
FILE: kotlin-examples/src/main/java/javaVariant/2ConditionsAndTypeSwitch.java
================================================
package javaVariant;

import java.sql.SQLException;
import java.util.Locale;

class Conditions {
    public Locale getDefaultLocale(String deliveryArea){
        if (deliveryArea.equals("germany") || deliveryArea.equals("austria") || deliveryArea.equals("switzerland")) {
            return Locale.GERMAN;
        }
        if (deliveryArea.equals("usa") || deliveryArea.equals("great britain") || deliveryArea.equals("australia")) {
            return Locale.ENGLISH;
        }
        throw new IllegalArgumentException("Unsupported deliveryArea " + deliveryArea);
    }
    //or via switch and fall-through


    //verbose. annoying type cast.
    public String getExceptionMessage(Exception exception){
        if (exception instanceof MyLabeledException){
            return ((MyLabeledException) exception).getLabel();
        } else if (exception instanceof SQLException){
            return exception.getMessage() + ". state: " + ((SQLException) exception).getSQLState();
        } else {
            return exception.getMessage();
        }
    }
}

class MyLabeledException extends RuntimeException{
    private String label;

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }
}

================================================
FILE: kotlin-examples/src/main/java/kotlinVariant/1DefineAndMapBeans.kt
================================================
package kotlinVariant

import java.time.Instant

//Data classes: Each entity definition in a single line! We get immutability, constructor, hashCode(), equals(), toString() for free.
class BlogEntity(val id: Long, val name: String, val posts: List<PostEntity>?)
class PostEntity(val id: Long, val date: Instant?, val author: AuthorEntity?, val text: String, comments: List<CommentEntity>?)
class AuthorEntity(val name: String, val email: String?)
class CommentEntity(val text: String, val author: AuthorEntity, date: Instant)
//"val" makes the beans immutable ("var" fields can be modified).
//The type "String" can never be null. The compiler enforces this!
//Contrarily, the type "String?" is nullable. Null-safe types make the code much safer and avoid bloating null checks.

class BlogDTO(val id: Long, val name: String, val posts: List<PostDTO>?)
class PostDTO(val id: Long, val author: String, val date: String?, val text: String, commentsHref: String)

//Usage of "single expression function": No body {} is necessary, if there is only a single expression.
//Less boilerplate with the collection API : we can call map() directly on a list and it returns a list.
//Implicit variable "it" (= parameter) makes lambda syntax even shorter. but you can also write "para -> mapToBlogDTO(para)".
fun mapToBlogDTOs(entities: List<BlogEntity>) = entities.map { mapToBlogDTO(it) }
fun mapToBlogDTO(entity: BlogEntity) = BlogDTO(
        id = entity.id,
        name = entity.name,
        posts = entity.posts?.map { mapToPostDTO(it) }
        //The Kotlin compiler forces me to consider that posts can be null.
        //We can't call map() directly on posts, because it can be null.
        //The null-safe call ("?.") invokes the operation only if posts are not null. Otherwise the whole expression is null.
)
fun mapToPostDTO(entity: PostEntity) = PostDTO(
        //easy to read due to named arguments.
        id = entity.id,
        date = entity.date?.epochSecond.toString(), //"?." (null safe call). if date is null, null is assigned. Otherwise the epochSecond is retrieved and assigned.
        author = entity.author?.name ?: "Anonymous", //The elvis operator ("?:") makes Java's getNameOrDefault() a one-liner! If left side of "?:" is null, the right side is returned. Otherwise the left side is returned.
        text = entity.text,
        commentsHref = "posts/${entity.id}/comments" //String interpolation!
)


//warp up: kotlin code is...
// a) extremely concise (data classes, single expression function, field accessor, compact list operations, null-safe calls, elvis operator),
//lines of code: 201 lines (java) vs 18 lines (kotlin)! (and java doesn't include hashCode(), toString(), hashCode())
//=> factor 11+ when it comes to code for structs and mapping!! no boilerplate in Kotlin.
// b) more readable (named arguments) and
// c) less error-prone (compiler enforced null safety, immutability, no manually written toString(), hashCode(), equals()).
// extremely reduced boilerplate.


================================================
FILE: kotlin-examples/src/main/java/kotlinVariant/2ConditionsAndTypeSwitch.kt
================================================
package kotlinVariant

import java.sql.SQLException
import java.util.Locale

//"when" is extremely powerful construct is Kotlin. It's much more than just a switch.

fun getDefaultLocale(deliveryArea: String): Locale {
    when (deliveryArea){
        "germany", "austria", "switzerland" -> return Locale.GERMAN
        "usa", "great britain", "australia" -> return Locale.ENGLISH
        else -> throw IllegalArgumentException("Unsupported deliveryArea $deliveryArea") //string interpolation
    }
}
// or even shorter as a single expression function:
fun getDefaultLocale2(deliveryArea: String) = when (deliveryArea){
    "germany", "austria", "switzerland" -> Locale.GERMAN
    "usa", "great britain", "australia" -> Locale.ENGLISH
    else -> throw IllegalArgumentException("Unsupported deliveryArea $deliveryArea")
}

fun getExceptionMessage(exception: Exception) = when (exception){
    //concise type switches
    is MyLabeledException -> exception.label //smart cast to MyLabeledException -> we can call label directly.
    is SQLException -> "${exception.message}. state: ${exception.sqlState}" //string interpolation
    else -> exception.message
}
class MyLabeledException(val label: String) : RuntimeException(label)

================================================
FILE: kotlin-idiomatic/.gitignore
================================================
.idea/
target/
*.iml

================================================
FILE: kotlin-idiomatic/pom.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>de.philipphauer.blog</groupId>
    <artifactId>kotlin-idiomatic</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <kotlin.version>1.1.1</kotlin.version>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-stdlib-jre8</artifactId>
            <version>${kotlin.version}</version>
        </dependency>
        <dependency>
            <groupId>com.jayway.jsonpath</groupId>
            <artifactId>json-path</artifactId>
            <version>2.2.0</version>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-server</artifactId>
            <version>8.0.3</version>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-client-compiled</artifactId>
            <version>8.0.3</version>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>4.5.3</version>
        </dependency>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-test</artifactId>
            <version>${kotlin.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-stdlib-jre8</artifactId>
            <version>${kotlin.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-dbcp2</artifactId>
            <version>2.1.1</version>
        </dependency>
    </dependencies>

    <build>
        <sourceDirectory>src/main/kotlin</sourceDirectory>
        <plugins>
            <plugin>
                <artifactId>kotlin-maven-plugin</artifactId>
                <groupId>org.jetbrains.kotlin</groupId>
                <version>${kotlin.version}</version>
                <executions>
                    <execution>
                        <id>compile</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>test-compile</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>test-compile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.5.1</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
                <executions>
                    <!-- Replacing default-compile as it is treated specially by maven -->
                    <execution>
                        <id>default-compile</id>
                        <phase>none</phase>
                    </execution>
                    <!-- Replacing default-testCompile as it is treated specially by maven -->
                    <execution>
                        <id>default-testCompile</id>
                        <phase>none</phase>
                    </execution>
                    <execution>
                        <id>java-compile</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>java-test-compile</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>testCompile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>

================================================
FILE: kotlin-idiomatic/src/main/kotlin/idiomaticKotlin/Apply.kt
================================================
package idiomaticKotlin

import org.apache.commons.dbcp2.BasicDataSource


fun blub(){
    // Don't
    val dataSource = BasicDataSource()
    dataSource.driverClassName = "com.mysql.jdbc.Driver"
    dataSource.url = "jdbc:mysql://domain:3309/db"
    dataSource.username = "username"
    dataSource.password = "password"
    dataSource.maxTotal = 40
    dataSource.maxIdle = 40
    dataSource.minIdle = 4
}

// Do
val dataSource = BasicDataSource().apply {
    driverClassName = "com.mysql.jdbc.Driver"
    url = "jdbc:mysql://domain:3309/db"
    username = "username"
    password = "password"
    maxTotal = 40
    maxIdle = 40
    minIdle = 4
}

================================================
FILE: kotlin-idiomatic/src/main/kotlin/idiomaticKotlin/DefaultArgs.kt
================================================
package idiomaticKotlin

// don't overload methods and constructors to realize default arguments ("chaining")
fun find(name: String){
    find(name, true)
}
fun find(name: String, recursive: Boolean){
}

// that are crutches. instead, Kotlin provides use named arguments
fun find2(name: String, recursive: Boolean = true){
}

// in fact, default arguments removed nearly all use cases for method and constructor overloading.

================================================
FILE: kotlin-idiomatic/src/main/kotlin/idiomaticKotlin/Destruction.kt
================================================
package idiomaticKotlin

//destruction useful for

//a) returning multiple values from a function. define an own data class or use Pair (but less expressive, no semantics)
data class ServiceConfig(val host: String, val port: Int)
fun createServiceConfig(): ServiceConfig {
    return ServiceConfig("api.domain.io", 9389)
}

fun bla(){
    val (host, port) = createServiceConfig()
}

//b) iterate over maps
fun foo(){
    val map = mapOf("api.domain.io" to 9389, "localhost" to 8080)
    for ((host, port) in map){
        //...
    }
}



================================================
FILE: kotlin-idiomatic/src/main/kotlin/idiomaticKotlin/FunctionalProgramming.kt
================================================
package idiomaticKotlin

import com.jayway.jsonpath.JsonPath
import java.util.Locale

// # Take advantages of functional programming support in Kotlin (better support then in java due to immutability and expression)
// -> reduce side-effects (less error-prone, easier to understand, thread-safe)
// (start with an enumeration of the relevant ##-points)

// ## use immutability (val for variables and properties, immutable data classes, copy(), kotlin's collection api (read-only))
data class Person(var name: String)
//better:
data class Person2(val name: String)

//var x = "hi"
//// better:
//val y = "hallo"

// ## use pure functions (without side-effects) where ever possible (therefore, use expressions and single expression functions)
// ## use if, when, try-catch, single expression function! -> concise, expressive, stateless
// expression instead of statements  (if, when) -> combine control structure with other expression concisely
// Don't:
fun getDefaultLocale(deliveryArea: String): Locale {
    val deliverAreaLower = deliveryArea.toLowerCase()
    if (deliverAreaLower == "germany" || deliverAreaLower == "austria") {
        return Locale.GERMAN
    }
    if (deliverAreaLower == "usa" || deliverAreaLower == "great britain") {
        return Locale.ENGLISH
    }
    if (deliverAreaLower == "french") {
        return Locale.FRENCH
    }
    return Locale.ENGLISH
}

// Do:
fun getDefaultLocale2(deliveryArea: String) = when (deliveryArea.toLowerCase()) {
    "germany", "austria" -> Locale.GERMAN
    "usa", "great britain" -> Locale.ENGLISH
    "french" -> Locale.FRENCH
    else -> Locale.ENGLISH
}
//println(getDefaultLocale("germany"))
// in general: consider if an `if` can be replace with a more concise `when` expression.

//try-catch is also an expression!
val json = """{"message":"HELLO"}"""
val message: String = try {
    JsonPath.parse(json).read("message")
} catch (ex: Exception) {
    json
}
//println(getMessage("""{"message":"HELLO"}""")) //hello

// ## use lambda expression to pass around 
Download .txt
gitextract_2r1gvc7i/

├── README.md
├── cairosvg-on-alpine/
│   ├── .gitignore
│   ├── Pipfile
│   ├── README.md
│   ├── docker-compose.yml
│   └── src/
│       ├── Dockerfile
│       └── svg-converter-service.py
├── cleaner-code-with-kotlin/
│   ├── .gitignore
│   ├── pom.xml
│   └── src/
│       └── main/
│           └── kotlin/
│               └── functions/
│                   ├── BeAware.kt
│                   ├── Expressions.kt
│                   ├── Immutability.kt
│                   ├── Nullability.kt
│                   ├── ProductClient.java
│                   └── ProductClientKotlin.kt
├── compare-payloads/
│   ├── .gitignore
│   ├── README.md
│   ├── compare-scripts/
│   │   ├── compare-all-final.sh
│   │   ├── compare-by-sorting.sh
│   │   ├── compare-json-payload.sh
│   │   └── compare-xml-payload.sh
│   ├── pom.xml
│   └── src/
│       └── main/
│           ├── java/
│           │   └── de/
│           │       └── philipphauer/
│           │           └── blog/
│           │               ├── BlogPost.java
│           │               ├── BlogPost2.java
│           │               └── ComparePayloadApplication.java
│           └── resources/
│               └── application.properties
├── continuation-token/
│   ├── .gitignore
│   ├── README.md
│   ├── continuation-token/
│   │   ├── .gitignore
│   │   ├── .mvn/
│   │   │   └── wrapper/
│   │   │       ├── maven-wrapper.jar
│   │   │       └── maven-wrapper.properties
│   │   ├── mvnw
│   │   ├── mvnw.cmd
│   │   ├── pom.xml
│   │   └── src/
│   │       ├── main/
│   │       │   └── kotlin/
│   │       │       └── de/
│   │       │           └── philipphauer/
│   │       │               └── blog/
│   │       │                   └── pagination/
│   │       │                       ├── ContinuationTokenParser.kt
│   │       │                       ├── Model.kt
│   │       │                       └── Pagination.kt
│   │       └── test/
│   │           └── kotlin/
│   │               └── de/
│   │                   └── philipphauer/
│   │                       └── blog/
│   │                           └── pagination/
│   │                               ├── ContinuationTokenParserTest.kt
│   │                               └── PaginationTest.kt
│   └── demo-kotlin/
│       ├── .gitignore
│       ├── .mvn/
│       │   └── wrapper/
│       │       ├── maven-wrapper.jar
│       │       └── maven-wrapper.properties
│       ├── mvnw
│       ├── mvnw.cmd
│       ├── pom.xml
│       └── src/
│           ├── main/
│           │   ├── kotlin/
│           │   │   └── de/
│           │   │       └── philipphauer/
│           │   │           └── blog/
│           │   │               ├── DesignDAO.kt
│           │   │               ├── DesignEntity.kt
│           │   │               ├── DesignResource.kt
│           │   │               ├── Main.kt
│           │   │               └── util/
│           │   │                   ├── DesignCreator.kt
│           │   │                   └── FunctionsMySQL.kt
│           │   └── resources/
│           │       └── create-designs-table.sql
│           └── test/
│               └── kotlin/
│                   └── de/
│                       └── philipphauer/
│                           └── blog/
│                               └── DesignResourceTest.kt
├── development-productivity-vaadin-spring-boot/
│   ├── .gitignore
│   ├── .mvn/
│   │   └── wrapper/
│   │       ├── maven-wrapper.jar
│   │       └── maven-wrapper.properties
│   ├── Makefile
│   ├── README.md
│   ├── mvnw
│   ├── mvnw.cmd
│   ├── pom.xml
│   ├── springloaded-1.2.9.BUILD-20170831.190856-1.jar
│   └── src/
│       └── main/
│           ├── java/
│           │   └── de/
│           │       └── philipphauer/
│           │           └── blog/
│           │               └── devproductivity/
│           │                   ├── DevProductivityApplication.java
│           │                   ├── WebSecurityConfiguration.java
│           │                   ├── model/
│           │                   │   ├── Role.java
│           │                   │   └── User.java
│           │                   ├── rest/
│           │                   │   └── AdminResource.java
│           │                   └── ui/
│           │                       └── MyAppUI.java
│           ├── resources/
│           │   └── application.properties
│           └── webapp/
│               └── VAADIN/
│                   └── themes/
│                       └── mytheme/
│                           ├── addons.scss
│                           ├── mytheme.scss
│                           └── styles.scss
├── dont-use-in-memory-databases-tests/
│   ├── db-container-managed-by-gradle/
│   │   ├── .gitignore
│   │   ├── build.gradle
│   │   ├── docker-compose.yml
│   │   ├── gradle/
│   │   │   └── wrapper/
│   │   │       ├── gradle-wrapper.jar
│   │   │       └── gradle-wrapper.properties
│   │   ├── gradlew
│   │   ├── gradlew.bat
│   │   ├── settings.gradle
│   │   └── src/
│   │       └── test/
│   │           └── java/
│   │               └── de/
│   │                   └── philipphauer/
│   │                       └── blog/
│   │                           └── MyTest.java
│   ├── db-container-managed-by-maven/
│   │   ├── .gitignore
│   │   ├── docker-compose.yml
│   │   ├── pom.xml
│   │   └── src/
│   │       └── test/
│   │           └── java/
│   │               └── de/
│   │                   └── philipphauer/
│   │                       └── blog/
│   │                           └── MyIT.java
│   └── db-container-managed-by-the-test/
│       ├── .gitignore
│       ├── build.gradle
│       ├── docker-compose.yml
│       ├── gradle/
│       │   └── wrapper/
│       │       ├── gradle-wrapper.jar
│       │       └── gradle-wrapper.properties
│       ├── gradlew
│       ├── gradlew.bat
│       ├── settings.gradle
│       └── src/
│           └── test/
│               └── java/
│                   └── de/
│                       └── philipphauer/
│                           └── blog/
│                               └── MyTest.java
├── framework-beats-generator/
│   ├── .gitignore
│   ├── pom.xml
│   ├── src/
│   │   ├── main/
│   │   │   ├── java/
│   │   │   │   └── de/
│   │   │   │       └── philipphauer/
│   │   │   │           ├── h2/
│   │   │   │           │   └── H2WebConsole.java
│   │   │   │           ├── jpa/
│   │   │   │           │   ├── Article.java
│   │   │   │           │   └── ArticleDAO.java
│   │   │   │           └── mongojack/
│   │   │   │               ├── Product.java
│   │   │   │               └── ProductDAO.java
│   │   │   └── resources/
│   │   │       └── META-INF/
│   │   │           └── persistence.xml
│   │   └── test/
│   │       └── java/
│   │           └── de/
│   │               └── philipphauer/
│   │                   ├── jpa/
│   │                   │   ├── ArticleDAOTest.java
│   │                   │   └── H2Test.java
│   │                   └── mongojack/
│   │                       └── ProductDAOTest.java
│   └── startMongoDBLocally.bat
├── kotlin-examples/
│   ├── .gitignore
│   ├── pom.xml
│   └── src/
│       └── main/
│           └── java/
│               ├── javaVariant/
│               │   ├── 1DefineAndMapBeans.java
│               │   └── 2ConditionsAndTypeSwitch.java
│               └── kotlinVariant/
│                   ├── 1DefineAndMapBeans.kt
│                   └── 2ConditionsAndTypeSwitch.kt
├── kotlin-idiomatic/
│   ├── .gitignore
│   ├── pom.xml
│   └── src/
│       └── main/
│           └── kotlin/
│               └── idiomaticKotlin/
│                   ├── Apply.kt
│                   ├── DefaultArgs.kt
│                   ├── Destruction.kt
│                   ├── FunctionalProgramming.kt
│                   ├── InitBlock.kt
│                   ├── Mapping.kt
│                   ├── NamedArgs.kt
│                   ├── Nullability.kt
│                   ├── ObjectForStatelessFWImpls.kt
│                   ├── Structs.kt
│                   ├── TopLevelExtensionFunctions.kt
│                   └── ValueObjects.kt
├── kotlin-spring-boot-vaadin-scaffolding/
│   ├── .gitignore
│   ├── README.md
│   ├── TODO.md
│   ├── docker-compose.yml
│   ├── myapp.yaml
│   ├── pom.xml
│   └── src/
│       ├── main/
│       │   ├── kotlin/
│       │   │   └── de/
│       │   │       └── philipphauer/
│       │   │           └── blog/
│       │   │               ├── misc/
│       │   │               │   ├── PuttingTogether.kt
│       │   │               │   ├── ValueObjects.kt
│       │   │               │   ├── constructorinjection/
│       │   │               │   │   ├── CRMClient.java
│       │   │               │   │   ├── ConstructorInjection.kt
│       │   │               │   │   ├── CustomerRepository.java
│       │   │               │   │   └── CustomerResource.java
│       │   │               │   └── vaadin/
│       │   │               │       ├── ActionListenerLambdaExample.kt
│       │   │               │       └── ActionListenerLambdaExampleJava.java
│       │   │               └── scaffolding/
│       │   │                   ├── DummyDataCreator.kt
│       │   │                   ├── MyApplication.kt
│       │   │                   ├── SpringConfiguration.kt
│       │   │                   ├── YamlConfigProps.kt
│       │   │                   ├── db/
│       │   │                   │   ├── Entities.kt
│       │   │                   │   └── SnippetRepository.kt
│       │   │                   ├── rest/
│       │   │                   │   └── AdminResource.kt
│       │   │                   └── ui/
│       │   │                       ├── Beans.kt
│       │   │                       ├── DetailsWindow.kt
│       │   │                       ├── EntityToBeanMapper.kt
│       │   │                       ├── MainViewDisplay.kt
│       │   │                       ├── MyAppUI.kt
│       │   │                       ├── NavigationPresenter.kt
│       │   │                       ├── UiMisc.kt
│       │   │                       └── views/
│       │   │                           ├── CreateSnippetView.kt
│       │   │                           ├── ErrorView.kt
│       │   │                           └── OverviewView.kt
│       │   └── resources/
│       │       ├── VAADIN/
│       │       │   └── themes/
│       │       │       └── mytheme/
│       │       │           ├── mytheme.scss
│       │       │           └── styles.scss
│       │       ├── application.properties
│       │       └── banner.txt
│       └── test/
│           └── kotlin/
│               └── de/
│                   └── philipphauer/
│                       └── blog/
│                           └── scaffolding/
│                               └── DummyDataCreatorTest.kt
├── modern-best-practices-testing-java/
│   ├── .gitignore
│   ├── docker-compose.yml
│   ├── pom.xml
│   └── src/
│       ├── main/
│       │   ├── java/
│       │   │   └── com/
│       │   │       └── phauer/
│       │   │           └── modernunittesting/
│       │   │               ├── FuturePlayground.java
│       │   │               ├── MainLayout.java
│       │   │               ├── ModernUnitTestingApplication.java
│       │   │               ├── PriceCalculator.java
│       │   │               ├── ProductController.java
│       │   │               ├── ProductDAO.java
│       │   │               ├── ProductDTO.java
│       │   │               ├── ProductEntity.java
│       │   │               ├── ProductModel.java
│       │   │               ├── ProductView.java
│       │   │               ├── SchemaCreator.java
│       │   │               ├── TaxServiceClient.java
│       │   │               └── TaxServiceResponseDTO.java
│       │   └── resources/
│       │       └── application.properties
│       └── test/
│           └── java/
│               └── com/
│                   └── phauer/
│                       └── modernunittesting/
│                           ├── AssertJTest.java
│                           ├── AwaitilityTest.java
│                           ├── DesignControllerTest.java
│                           ├── DisplayNameTest.java
│                           ├── HelperFunctions.java
│                           ├── ParameterTest.java
│                           ├── Product.java
│                           ├── ProductControllerITest.java
│                           ├── ProductControllerITest2.java
│                           ├── ProductViewITest.java
│                           └── RandomizedValues.java
├── modern-integration-testing/
│   ├── .gitignore
│   ├── docker-compose.yml
│   ├── pom.xml
│   └── src/
│       ├── main/
│       │   ├── java/
│       │   │   └── com/
│       │   │       └── phauer/
│       │   │           └── modernunittesting/
│       │   │               ├── MainLayout.java
│       │   │               ├── ModernUnitTestingApplication.java
│       │   │               ├── PriceCalculator.java
│       │   │               ├── ProductController.java
│       │   │               ├── ProductDAO.java
│       │   │               ├── ProductDTO.java
│       │   │               ├── ProductEntity.java
│       │   │               ├── ProductModel.java
│       │   │               ├── ProductView.java
│       │   │               ├── SchemaCreator.java
│       │   │               ├── TaxServiceClient.java
│       │   │               └── TaxServiceResponseDTO.java
│       │   └── resources/
│       │       └── application.properties
│       └── test/
│           └── java/
│               └── com/
│                   └── phauer/
│                       └── modernunittesting/
│                           ├── AssertJTest.java
│                           ├── Product.java
│                           ├── ProductControllerITest.java
│                           ├── ProductControllerITest2.java
│                           └── ProductViewITest.java
├── mongodb-practice/
│   ├── connection-strings.sh
│   ├── docker-compose.yml
│   ├── example.json
│   └── local-dev/
│       └── mongo-seeding/
│           ├── Dockerfile
│           └── seedMongo.py
├── python-demo/
│   ├── .gitignore
│   ├── 1concise-powerful.py
│   ├── 2collections.py
│   ├── 3functions.py
│   ├── 4classes.py
│   └── 5operator-overloading.py
├── rest-api-doc-jaxrs-swagger-asciidoc/
│   ├── .gitignore
│   ├── README.md
│   ├── config.yml
│   ├── generate-documentation.sh
│   ├── pom.xml
│   ├── src/
│   │   ├── docs/
│   │   │   └── asciidoc/
│   │   │       ├── custom.css
│   │   │       ├── general-remarks.adoc
│   │   │       ├── index.adoc
│   │   │       └── usage.adoc
│   │   └── main/
│   │       ├── java/
│   │       │   └── de/
│   │       │       └── philipphauer/
│   │       │           └── blog/
│   │       │               ├── RestApiDocApplication.java
│   │       │               ├── RestApiDocConfiguration.java
│   │       │               ├── apiDocGen/
│   │       │               │   └── SwaggerAndAsciiDocGenerator.java
│   │       │               └── resources/
│   │       │                   ├── BandResource.java
│   │       │                   ├── CORSFilter.java
│   │       │                   ├── DocumentationResource.java
│   │       │                   └── dto/
│   │       │                       ├── BandCreationDTO.java
│   │       │                       └── BandRetrievalDTO.java
│   │       └── resources/
│   │           └── banner.txt
│   └── swagger-ui/
│       └── docker-compose.yml
├── sealedclasses/
│   ├── .gitignore
│   ├── docker-compose.yml
│   ├── pom.xml
│   ├── service-stub/
│   │   ├── Dockerfile
│   │   └── service-stub.py
│   └── src/
│       ├── main/
│       │   └── kotlin/
│       │       └── com/
│       │           └── phauer/
│       │               ├── HttpUserProfileClient.kt
│       │               ├── ImageAvailabilityClient.kt
│       │               ├── LdapDAO.kt
│       │               └── common/
│       │                   └── Common.kt
│       └── test/
│           └── kotlin/
│               └── com/
│                   └── phauer/
│                       └── HelloTest.kt
├── smooth-local-dev-docker/
│   ├── .gitignore
│   ├── Pipfile
│   ├── bla.conf
│   ├── docker-compose.yml
│   ├── local-dev/
│   │   ├── external-service-stub/
│   │   │   ├── Dockerfile
│   │   │   ├── Pipfile
│   │   │   ├── external-service-stub.py
│   │   │   └── static-user-response.json
│   │   ├── external-service-wrapped/
│   │   │   ├── Dockerfile
│   │   │   └── config.yaml
│   │   ├── mongo-seeding/
│   │   │   ├── Dockerfile
│   │   │   ├── Pipfile
│   │   │   └── seed-mongo.py
│   │   └── mysql-seeding/
│   │       ├── Dockerfile
│   │       ├── Pipfile
│   │       └── seed-mysql.py
│   ├── pom.xml
│   └── src/
│       ├── main/
│       │   └── kotlin/
│       │       └── de/
│       │           └── philipphauer/
│       │               └── blog/
│       │                   ├── ExternalServiceUserClient.kt
│       │                   ├── Main.kt
│       │                   ├── MongoDesignDAO.kt
│       │                   └── MySqlUserDAO.kt
│       └── test/
│           └── kotlin/
│               └── de/
│                   └── philipphauer/
│                       └── blog/
│                           └── HelloTest.kt
├── testingrestservice/
│   ├── integration-tests/
│   │   ├── .gitignore
│   │   ├── pom.xml
│   │   └── src/
│   │       └── test/
│   │           └── java/
│   │               └── de/
│   │                   └── philipphauer/
│   │                       └── blog/
│   │                           └── testingrestservice/
│   │                               └── integrationtests/
│   │                                   ├── BlogsTest.java
│   │                                   ├── dto/
│   │                                   │   ├── BlogDTO.java
│   │                                   │   └── BlogListDTO.java
│   │                                   └── dtoKotlin/
│   │                                       ├── BlogDTOKotlin.kt
│   │                                       └── BlogsKotlinTest.kt
│   └── service/
│       ├── .gitignore
│       ├── pom.xml
│       └── src/
│           ├── main/
│           │   ├── java/
│           │   │   └── de/
│           │   │       └── philipphauer/
│           │   │           └── blog/
│           │   │               └── testingrestservice/
│           │   │                   └── service/
│           │   │                       ├── BlogApplication.java
│           │   │                       ├── dataaccess/
│           │   │                       │   ├── BlogRepository.java
│           │   │                       │   ├── DatabaseInitializer.java
│           │   │                       │   ├── PostRepository.java
│           │   │                       │   └── entities/
│           │   │                       │       ├── BlogEntity.java
│           │   │                       │       ├── CommentEntity.java
│           │   │                       │       └── PostEntity.java
│           │   │                       ├── rest/
│           │   │                       │   ├── BlogsResource.java
│           │   │                       │   └── dto/
│           │   │                       │       ├── BlogDTO.java
│           │   │                       │       ├── BlogsDTO.java
│           │   │                       │       └── ReferenceDTO.java
│           │   │                       └── servicecall/
│           │   │                           ├── ImageReference.java
│           │   │                           └── ImageServiceClient.java
│           │   └── resources/
│           │       └── application.properties
│           └── test/
│               └── java/
│                   └── de/
│                       └── philipphauer/
│                           └── blog/
│                               └── testingrestservice/
│                                   └── service/
│                                       └── servicecall/
│                                           └── ImageReferenceServiceClientTest.java
├── ti-continuation-token/
│   ├── .gitignore
│   ├── .mvn/
│   │   └── wrapper/
│   │       ├── maven-wrapper.jar
│   │       └── maven-wrapper.properties
│   ├── README.md
│   ├── mvnw
│   ├── mvnw.cmd
│   ├── pom.xml
│   └── src/
│       ├── main/
│       │   ├── kotlin/
│       │   │   └── de/
│       │   │       └── philipphauer/
│       │   │           └── blog/
│       │   │               └── pagination/
│       │   │                   ├── DesignDAO.kt
│       │   │                   ├── DesignEntity.kt
│       │   │                   ├── DesignResource.kt
│       │   │                   ├── Main.kt
│       │   │                   ├── token/
│       │   │                   │   ├── Model.kt
│       │   │                   │   └── Pagination.kt
│       │   │                   └── util/
│       │   │                       ├── DesignDatabaseUtil.kt
│       │   │                       └── FunctionsMySQL.kt
│       │   └── resources/
│       │       └── create-designs-table.sql
│       └── test/
│           └── kotlin/
│               └── de/
│                   └── philipphauer/
│                       └── blog/
│                           └── pagination/
│                               ├── Common.kt
│                               ├── DesignResourceTest.kt
│                               ├── PaginationClient.kt
│                               └── token/
│                                   └── PaginationTest.kt
├── unit-tests-kotlin/
│   ├── .gitignore
│   ├── pom.xml
│   └── src/
│       ├── main/
│       │   └── kotlin/
│       │       └── com/
│       │           └── phauer/
│       │               └── unittestkotlin/
│       │                   └── MongoDAO.kt
│       └── test/
│           ├── kotlin/
│           │   └── com/
│           │       └── phauer/
│           │           └── unittestkotlin/
│           │               ├── BackticksAndNestedClasses.kt
│           │               ├── DataClassAssertions.kt
│           │               ├── HandlingState.kt
│           │               ├── IntroductionExample.kt
│           │               ├── KGenericContainer.kt
│           │               ├── MockHandling.kt
│           │               ├── MongoDAOTestJUnit4.kt
│           │               ├── MongoDAOTestJUnit5.kt
│           │               ├── ParseTest.kt
│           │               ├── ParseTestKotest.kt
│           │               ├── TestSpecificExtFunctions.kt
│           │               ├── assertAllOrSomeFields/
│           │               │   └── AssertAllOrSomeFields.kt
│           │               ├── foo/
│           │               │   ├── CreationHelper.kt
│           │               │   └── MockK.kt
│           │               └── mockk/
│           │                   ├── UserScheduler.kt
│           │                   └── UserSchedulerTest_MockK.kt
│           └── resources/
│               └── mockito-extensions/
│                   └── org.mockito.plugins.MockMakerXXX
├── uuid-mysql-hibernate/
│   ├── .gitignore
│   ├── README.md
│   ├── docker-compose.yml
│   ├── pom.xml
│   └── src/
│       └── main/
│           ├── java/
│           │   └── de/
│           │       └── philipphauer/
│           │           └── blog/
│           │               ├── ProductsResource.java
│           │               ├── UuidMysqlHibernateApplication.java
│           │               └── model/
│           │                   └── Product.java
│           └── resources/
│               └── application.properties
├── vaadin-10-sass-cssrefresh/
│   ├── .gitignore
│   ├── README.md
│   ├── pom.xml
│   └── src/
│       └── main/
│           ├── java/
│           │   └── com/
│           │       └── phauer/
│           │           └── vaadin10sasscssrefresh/
│           │               ├── CustomVaadinServiceListener.java
│           │               ├── ExampleView.java
│           │               ├── MainLayout.java
│           │               └── Vaadin10SassCssrefreshApplication.java
│           └── resources/
│               ├── META-INF/
│               │   └── resources/
│               │       ├── frontend/
│               │       │   └── styles/
│               │       │       ├── exampleView.scss
│               │       │       ├── main.scss
│               │       │       └── variables.scss
│               │       └── js/
│               │           └── cssrefresh.js
│               └── application.properties
└── versioning-continuous-delivery/
    ├── .gitignore
    ├── README.md
    ├── docker-compose.yml
    ├── pom.xml
    └── src/
        └── main/
            ├── java/
            │   └── de/
            │       └── philipphauer/
            │           └── blog/
            │               └── VersioningContinuousDeliveryApplication.java
            └── resources/
                └── application.properties
Download .txt
SYMBOL INDEX (589 symbols across 114 files)

FILE: cairosvg-on-alpine/src/svg-converter-service.py
  function convert_image (line 7) | def convert_image():

FILE: cleaner-code-with-kotlin/src/main/kotlin/functions/ProductClient.java
  class ProductClient (line 6) | public class ProductClient {
    method parseProductFromHttpBody (line 8) | public Product parseProductFromHttpBody(Response response){
    method mapToDTO (line 25) | private Product mapToDTO(ResponseBody body) {
    class Product (line 29) | public static class Product{
    class ProductClientException (line 33) | public static class ProductClientException extends RuntimeException{
      method ProductClientException (line 34) | public ProductClientException(String message) {

FILE: compare-payloads/src/main/java/de/philipphauer/blog/BlogPost.java
  class BlogPost (line 8) | public class BlogPost {
    method getAuthor (line 14) | public String getAuthor() {
    method setAuthor (line 18) | public BlogPost setAuthor(String author) {
    method getContent (line 23) | public String getContent() {
    method setContent (line 27) | public BlogPost setContent(String content) {
    method getCreated (line 32) | public Instant getCreated() {
    method setCreated (line 36) | public BlogPost setCreated(Instant created) {

FILE: compare-payloads/src/main/java/de/philipphauer/blog/BlogPost2.java
  class BlogPost2 (line 5) | public class BlogPost2 {
    method getAuthorName (line 11) | public String getAuthorName() {
    method setAuthorName (line 15) | public BlogPost2 setAuthorName(String authorName) {
    method getContent (line 20) | public String getContent() {
    method setContent (line 24) | public BlogPost2 setContent(String content) {
    method getCreated (line 29) | public String getCreated() {
    method setCreated (line 33) | public BlogPost2 setCreated(String created) {

FILE: compare-payloads/src/main/java/de/philipphauer/blog/ComparePayloadApplication.java
  class ComparePayloadApplication (line 16) | @SpringBootApplication
    method main (line 20) | public static void main(String[] args) {
    method ComparePayloadApplication (line 27) | public ComparePayloadApplication(){
    method getBlogPosts (line 37) | @RequestMapping(value = "/blogposts", produces = {MediaType.APPLICATIO...
    method getBlogPosts2 (line 42) | @RequestMapping(value = "/blogposts2", produces = {MediaType.APPLICATI...
    method format (line 49) | private String format(Instant now) {

FILE: continuation-token/demo-kotlin/src/main/resources/create-designs-table.sql
  type designs (line 1) | CREATE TABLE designs (

FILE: development-productivity-vaadin-spring-boot/src/main/java/de/philipphauer/blog/devproductivity/DevProductivityApplication.java
  class DevProductivityApplication (line 6) | @SpringBootApplication
    method main (line 9) | public static void main(String[] args) {

FILE: development-productivity-vaadin-spring-boot/src/main/java/de/philipphauer/blog/devproductivity/WebSecurityConfiguration.java
  class WebSecurityConfiguration (line 8) | @Configuration
    method configure (line 10) | @Override

FILE: development-productivity-vaadin-spring-boot/src/main/java/de/philipphauer/blog/devproductivity/model/Role.java
  type Role (line 3) | public enum Role {

FILE: development-productivity-vaadin-spring-boot/src/main/java/de/philipphauer/blog/devproductivity/model/User.java
  class User (line 3) | public class User {
    method getId (line 11) | public int getId() {
    method setId (line 15) | public User setId(int id) {
    method getFirstName (line 20) | public String getFirstName() {
    method setFirstName (line 24) | public User setFirstName(String firstName) {
    method getLastName (line 29) | public String getLastName() {
    method setLastName (line 33) | public User setLastName(String lastName) {
    method getAge (line 38) | public int getAge() {
    method setAge (line 42) | public User setAge(int age) {
    method getRole (line 47) | public Role getRole() {
    method setRole (line 51) | public User setRole(Role role) {
    method isActive (line 56) | public boolean isActive() {
    method setActive (line 60) | public User setActive(boolean active) {

FILE: development-productivity-vaadin-spring-boot/src/main/java/de/philipphauer/blog/devproductivity/rest/AdminResource.java
  class AdminResource (line 6) | @Controller
    method redirectToUI (line 9) | @GetMapping("/")
    method favicon (line 14) | @GetMapping("favicon.ico")
    method customResource (line 19) | @GetMapping("/customResource")

FILE: development-productivity-vaadin-spring-boot/src/main/java/de/philipphauer/blog/devproductivity/ui/MyAppUI.java
  class MyAppUI (line 19) | @SpringUI(path = "")
    method init (line 26) | @Override
    method generateDummyUsers (line 43) | private List<User> generateDummyUsers() {

FILE: dont-use-in-memory-databases-tests/db-container-managed-by-gradle/src/test/java/de/philipphauer/blog/MyTest.java
  class MyTest (line 13) | public class MyTest {
    method init (line 17) | @BeforeClass
    method foo (line 32) | @Test

FILE: dont-use-in-memory-databases-tests/db-container-managed-by-maven/src/test/java/de/philipphauer/blog/MyIT.java
  class MyIT (line 13) | public class MyIT {
    method init (line 17) | @BeforeClass
    method foo (line 32) | @Test

FILE: dont-use-in-memory-databases-tests/db-container-managed-by-the-test/src/test/java/de/philipphauer/blog/MyTest.java
  class MyTest (line 15) | public class MyTest {
    method init (line 20) | @BeforeClass
    method destroy (line 34) | @AfterClass
    method foo (line 39) | @Test

FILE: framework-beats-generator/src/main/java/de/philipphauer/h2/H2WebConsole.java
  class H2WebConsole (line 7) | public class H2WebConsole {
    method start (line 9) | public static void start() {

FILE: framework-beats-generator/src/main/java/de/philipphauer/jpa/Article.java
  class Article (line 7) | @Entity
    method Article (line 16) | public Article(String name){
    method Article (line 20) | public Article(){
    method getName (line 23) | public String getName() {
    method getId (line 27) | public int getId() {

FILE: framework-beats-generator/src/main/java/de/philipphauer/jpa/ArticleDAO.java
  class ArticleDAO (line 9) | public class ArticleDAO {
    method ArticleDAO (line 13) | public ArticleDAO() {
    method save (line 18) | public void save(Article article) {
    method findAll (line 24) | public Collection<Article> findAll() {
    method close (line 29) | public void close(){

FILE: framework-beats-generator/src/main/java/de/philipphauer/mongojack/Product.java
  class Product (line 5) | public class Product {
    method Product (line 11) | public Product(String name, int price) {
    method getId (line 16) | public String getId() {
    method getName (line 20) | public String getName() {
    method getPrice (line 24) | public int getPrice() {

FILE: framework-beats-generator/src/main/java/de/philipphauer/mongojack/ProductDAO.java
  class ProductDAO (line 11) | public class ProductDAO {
    method save (line 13) | public void save(Product product) throws UnknownHostException {

FILE: framework-beats-generator/src/test/java/de/philipphauer/jpa/ArticleDAOTest.java
  class ArticleDAOTest (line 6) | public class ArticleDAOTest {
    method saveAndLoad (line 8) | @Test

FILE: framework-beats-generator/src/test/java/de/philipphauer/jpa/H2Test.java
  class H2Test (line 9) | public class H2Test {
    method connection (line 11) | @Test

FILE: framework-beats-generator/src/test/java/de/philipphauer/mongojack/ProductDAOTest.java
  class ProductDAOTest (line 5) | public class ProductDAOTest {
    method save (line 7) | @Test

FILE: kotlin-examples/src/main/java/javaVariant/1DefineAndMapBeans.java
  class BlogEntity (line 12) | class BlogEntity {
    method BlogEntity (line 20) | public BlogEntity(long id, String name, List<PostEntity> posts) {
    method getName (line 26) | public String getName() {
    method getPosts (line 30) | public List<PostEntity> getPosts() {
    method getId (line 34) | public long getId() {
  class PostEntity (line 39) | class PostEntity {
    method PostEntity (line 46) | public PostEntity(long id, AuthorEntity author, Instant date, String t...
    method getAuthor (line 54) | public AuthorEntity getAuthor() {
    method getDate (line 58) | public Instant getDate() {
    method getText (line 62) | public String getText() {
    method getComments (line 66) | public List<CommentEntity> getComments() {
    method getId (line 70) | public long getId() {
  class AuthorEntity (line 75) | class AuthorEntity {
    method AuthorEntity (line 79) | public AuthorEntity(String name, String email) {
    method getName (line 84) | public String getName() {
    method getEmail (line 88) | public String getEmail() {
  class CommentEntity (line 93) | class CommentEntity {
    method CommentEntity (line 98) | public CommentEntity(String text, AuthorEntity author, Instant date) {
    method getText (line 104) | public String getText() {
    method getAuthor (line 108) | public AuthorEntity getAuthor() {
    method getDate (line 112) | public Instant getDate() {
  class BlogDTO (line 117) | class BlogDTO{
    method BlogDTO (line 122) | public BlogDTO(long id, String name, List<PostDTO> posts) {
    method getName (line 128) | public String getName() {
    method getPosts (line 132) | public List<PostDTO> getPosts() {
    method getId (line 136) | public long getId() {
  class PostDTO (line 141) | class PostDTO{
    method PostDTO (line 148) | public PostDTO(long id, String date, String author, String text, Strin...
    method getAuthor (line 156) | public String getAuthor() {
    method getDate (line 160) | public String getDate() {
    method getText (line 164) | public String getText() {
    method getCommentsHref (line 168) | public String getCommentsHref() {
    method getId (line 172) | public long getId() {
  class Mapper (line 177) | class Mapper {
    method mapToBlogDTOs (line 178) | public List<BlogDTO> mapToBlogDTOs(List<BlogEntity> entities){
    method mapToBlogDTO (line 184) | private BlogDTO mapToBlogDTO(BlogEntity entity){
    method mapToPostDTO (line 192) | private List<PostDTO> mapToPostDTO(List<PostEntity> posts) {
    method mapToPostDTO (line 199) | private PostDTO mapToPostDTO(PostEntity post) {
    method getNameOrDefault (line 212) | private String getNameOrDefault(AuthorEntity author) {

FILE: kotlin-examples/src/main/java/javaVariant/2ConditionsAndTypeSwitch.java
  class Conditions (line 6) | class Conditions {
    method getDefaultLocale (line 7) | public Locale getDefaultLocale(String deliveryArea){
    method getExceptionMessage (line 20) | public String getExceptionMessage(Exception exception){
  class MyLabeledException (line 31) | class MyLabeledException extends RuntimeException{
    method getLabel (line 34) | public String getLabel() {
    method setLabel (line 38) | public void setLabel(String label) {

FILE: kotlin-spring-boot-vaadin-scaffolding/src/main/kotlin/de/philipphauer/blog/misc/constructorinjection/CRMClient.java
  class CRMClient (line 3) | public class CRMClient {

FILE: kotlin-spring-boot-vaadin-scaffolding/src/main/kotlin/de/philipphauer/blog/misc/constructorinjection/CustomerRepository.java
  class CustomerRepository (line 3) | public class CustomerRepository {

FILE: kotlin-spring-boot-vaadin-scaffolding/src/main/kotlin/de/philipphauer/blog/misc/constructorinjection/CustomerResource.java
  class CustomerResource (line 3) | public class CustomerResource {
    method CustomerResource (line 8) | public CustomerResource(CustomerRepository repo, CRMClient client) {

FILE: kotlin-spring-boot-vaadin-scaffolding/src/main/kotlin/de/philipphauer/blog/misc/vaadin/ActionListenerLambdaExampleJava.java
  class ActionListenerLambdaExampleJava (line 6) | public class ActionListenerLambdaExampleJava {
    method bla (line 8) | private void bla(){
    method greet (line 15) | private void greet(Button.ClickEvent event){

FILE: modern-best-practices-testing-java/src/main/java/com/phauer/modernunittesting/FuturePlayground.java
  class FuturePlayground (line 9) | public class FuturePlayground {
    method bla (line 11) | public void bla() throws ExecutionException, InterruptedException {
    method start (line 18) | @Scheduled
    method doBusinessLogic (line 23) | String doBusinessLogic(Locale locale) {

FILE: modern-best-practices-testing-java/src/main/java/com/phauer/modernunittesting/MainLayout.java
  class MainLayout (line 8) | @Push

FILE: modern-best-practices-testing-java/src/main/java/com/phauer/modernunittesting/ModernUnitTestingApplication.java
  class ModernUnitTestingApplication (line 6) | @SpringBootApplication
    method main (line 9) | public static void main(String[] args) {

FILE: modern-best-practices-testing-java/src/main/java/com/phauer/modernunittesting/PriceCalculator.java
  class PriceCalculator (line 5) | @Component

FILE: modern-best-practices-testing-java/src/main/java/com/phauer/modernunittesting/ProductController.java
  class ProductController (line 9) | @RestController
    method ProductController (line 14) | public ProductController(ProductDAO dao, TaxServiceClient client, Pric...
    method getProducts (line 18) | @GetMapping("/products")
    method toDto (line 24) | private List<ProductDTO> toDto(List<ProductEntity> products) {
    method toDto (line 30) | private ProductDTO toDto(ProductEntity entity) {

FILE: modern-best-practices-testing-java/src/main/java/com/phauer/modernunittesting/ProductDAO.java
  class ProductDAO (line 10) | @Component
    method ProductDAO (line 15) | public ProductDAO(JdbcTemplate template) {
    method findProducts (line 19) | public List<ProductEntity> findProducts() {
    method map (line 23) | private ProductEntity map(ResultSet resultSet, int i) throws SQLExcept...

FILE: modern-best-practices-testing-java/src/main/java/com/phauer/modernunittesting/ProductDTO.java
  class ProductDTO (line 6) | public class ProductDTO {
    method getPrice (line 11) | public double getPrice() {
    method setPrice (line 15) | public ProductDTO setPrice(double price) {
    method getId (line 20) | public String getId() {
    method setId (line 24) | public ProductDTO setId(String id) {
    method getName (line 29) | public String getName() {
    method setName (line 33) | public ProductDTO setName(String name) {
    method toString (line 38) | @Override
    method equals (line 47) | @Override
    method hashCode (line 57) | @Override

FILE: modern-best-practices-testing-java/src/main/java/com/phauer/modernunittesting/ProductEntity.java
  class ProductEntity (line 3) | public class ProductEntity {
    method getDescription (line 10) | public String getDescription() {
    method setDescription (line 14) | public ProductEntity setDescription(String description) {
    method getStockAmount (line 19) | public int getStockAmount() {
    method setStockAmount (line 23) | public ProductEntity setStockAmount(int stockAmount) {
    method getCategory (line 28) | public String getCategory() {
    method setCategory (line 32) | public ProductEntity setCategory(String category) {
    method getId (line 37) | public String getId() {
    method setId (line 41) | public ProductEntity setId(String id) {
    method getName (line 46) | public String getName() {
    method setName (line 50) | public ProductEntity setName(String name) {

FILE: modern-best-practices-testing-java/src/main/java/com/phauer/modernunittesting/ProductModel.java
  class ProductModel (line 6) | public class ProductModel {
    method getId (line 10) | public String getId() {
    method setId (line 14) | public ProductModel setId(String id) {
    method getName (line 19) | public String getName() {
    method setName (line 23) | public ProductModel setName(String name) {
    method equals (line 28) | @Override
    method hashCode (line 37) | @Override
    method toString (line 42) | @Override

FILE: modern-best-practices-testing-java/src/main/java/com/phauer/modernunittesting/ProductView.java
  class ProductView (line 13) | @Route(value = "", layout = MainLayout.class)
    method ProductView (line 21) | public ProductView(ProductDAO dao) {
    method initView (line 26) | private void initView() {
    method loadButtonHandler (line 35) | private void loadButtonHandler(ClickEvent event) {
    method toModel (line 40) | private List<ProductModel> toModel(List<ProductEntity> products) {
    method toModel (line 46) | private ProductModel toModel(ProductEntity entity) {

FILE: modern-best-practices-testing-java/src/main/java/com/phauer/modernunittesting/SchemaCreator.java
  class SchemaCreator (line 8) | @Component
    method SchemaCreator (line 13) | public SchemaCreator(JdbcTemplate jdbcTemplate) {
    method run (line 17) | @Override
    method createSchema (line 28) | public static void createSchema(JdbcTemplate jdbcTemplate) {

FILE: modern-best-practices-testing-java/src/main/java/com/phauer/modernunittesting/TaxServiceClient.java
  class TaxServiceClient (line 5) | @Component
    method TaxServiceClient (line 7) | public TaxServiceClient() {
    method TaxServiceClient (line 11) | public TaxServiceClient(String url) {

FILE: modern-best-practices-testing-java/src/main/java/com/phauer/modernunittesting/TaxServiceResponseDTO.java
  class TaxServiceResponseDTO (line 5) | public class TaxServiceResponseDTO {
    method TaxServiceResponseDTO (line 10) | public TaxServiceResponseDTO(Locale germany, double rate) {
    method getLocale (line 14) | public String getLocale() {
    method setLocale (line 18) | public TaxServiceResponseDTO setLocale(String locale) {
    method getRate (line 23) | public double getRate() {
    method setRate (line 27) | public TaxServiceResponseDTO setRate(double rate) {

FILE: modern-best-practices-testing-java/src/test/java/com/phauer/modernunittesting/AssertJTest.java
  class AssertJTest (line 12) | public class AssertJTest {
    method bla (line 14) | @Test
    method createProductDTO (line 73) | private Product createProductDTO(String s, String smartphone, double v) {

FILE: modern-best-practices-testing-java/src/test/java/com/phauer/modernunittesting/AwaitilityTest.java
  class AwaitilityTest (line 11) | public class AwaitilityTest {
    method waitAndPoll (line 17) | @Test
    method triggerAsyncEvent (line 25) | private void triggerAsyncEvent() {
    method findInDatabase (line 29) | private Thread findInDatabase(int i) {
    type State (line 33) | enum State {

FILE: modern-best-practices-testing-java/src/test/java/com/phauer/modernunittesting/DesignControllerTest.java
  class DesignControllerTest (line 6) | public class DesignControllerTest {
    class GetDesigns (line 7) | @Nested
      method allFieldsAreIncluded (line 9) | @Test
      method limitParameter (line 13) | @Test
      method filterParameter (line 17) | @Test
    class DeleteDesign (line 22) | @Nested
      method designIsRemovedFromDb (line 24) | @Test
      method return404OnInvalidIdParameter (line 28) | @Test
      method return401IfNotAuthorized (line 32) | @Test

FILE: modern-best-practices-testing-java/src/test/java/com/phauer/modernunittesting/DisplayNameTest.java
  class DisplayNameTest (line 6) | public class DisplayNameTest {
    method designIsRemoved (line 7) | @Test
    method return404 (line 12) | @Test
    method return401 (line 17) | @Test

FILE: modern-best-practices-testing-java/src/test/java/com/phauer/modernunittesting/HelperFunctions.java
  class HelperFunctions (line 28) | @TestInstance(TestInstance.Lifecycle.PER_CLASS)
    method setup (line 35) | @BeforeAll
    method categoryQueryParameter (line 66) | @Test
    method categoryQueryParameter2 (line 88) | @Test
    method createSqlInsertStatement (line 103) | private String createSqlInsertStatement(ProductEntity product) {
    method createProductWithCategory (line 107) | private ProductEntity createProductWithCategory(String id, String cate...
    method requestProductsByCategory (line 111) | private String requestProductsByCategory(String category) throws Excep...
    method toDTOs (line 117) | private List<ProductDTO> toDTOs(String string) throws IOException {
    method insertIntoDatabase (line 123) | private void insertIntoDatabase(ProductEntity... products) {
    method toJson (line 129) | private String toJson(TaxServiceResponseDTO taxServiceResponseDTO) thr...
    method createDataSourceAndStartDatabaseIfNecessary (line 133) | private DataSource createDataSourceAndStartDatabaseIfNecessary() {
    method beforeEach (line 152) | @BeforeEach

FILE: modern-best-practices-testing-java/src/test/java/com/phauer/modernunittesting/ParameterTest.java
  class ParameterTest (line 8) | public class ParameterTest {
    method add (line 12) | @ParameterizedTest
  class Calculator (line 23) | class Calculator {
    method add (line 25) | public int add(int summand1, int summand2) {

FILE: modern-best-practices-testing-java/src/test/java/com/phauer/modernunittesting/Product.java
  class Product (line 7) | public class Product {
    method Product (line 15) | public Product() {
    method Product (line 19) | public Product(int id, String name, String category) {
    method getId (line 26) | public int getId() {
    method setId (line 30) | public Product setId(int id) {
    method getName (line 35) | public String getName() {
    method setName (line 39) | public Product setName(String name) {
    method getCategory (line 44) | public String getCategory() {
    method setCategory (line 48) | public Product setCategory(String category) {
    method getDateCreated (line 53) | public Instant getDateCreated() {
    method setDateCreated (line 57) | public Product setDateCreated(Instant dateCreated) {
    method isLiked (line 62) | public boolean isLiked() {
    method setLiked (line 66) | public Product setLiked(boolean liked) {
    method equals (line 71) | @Override
    method hashCode (line 80) | @Override
    method toString (line 85) | @Override

FILE: modern-best-practices-testing-java/src/test/java/com/phauer/modernunittesting/ProductControllerITest.java
  class ProductControllerITest (line 30) | @TestInstance(TestInstance.Lifecycle.PER_CLASS)
    method setup (line 37) | @BeforeAll
    method databaseDataIsCorrectlyReturned (line 67) | @Test
    method toDTOs (line 89) | private List<ProductDTO> toDTOs(String string) throws IOException {
    method insertIntoDatabase (line 95) | private void insertIntoDatabase(ProductEntity... products) {
    method toJson (line 102) | private String toJson(TaxServiceResponseDTO taxServiceResponseDTO) thr...
    method createDataSourceAndStartDatabaseIfNecessary (line 106) | private DataSource createDataSourceAndStartDatabaseIfNecessary() {
    method beforeEach (line 125) | @BeforeEach

FILE: modern-best-practices-testing-java/src/test/java/com/phauer/modernunittesting/ProductControllerITest2.java
  class ProductControllerITest2 (line 6) | @WebMvcTest(ProductController.class)
    method foo (line 9) | @Test

FILE: modern-best-practices-testing-java/src/test/java/com/phauer/modernunittesting/ProductViewITest.java
  class ProductViewITest (line 21) | @TestInstance(TestInstance.Lifecycle.PER_CLASS)
    method beforeAll (line 27) | @BeforeAll
    method beforeEach (line 42) | @BeforeEach
    method prodcutsAreCorrectlyDisplayedInTable (line 48) | @Test
    method insertIntoDatabase (line 64) | private void insertIntoDatabase(ProductEntity... products) {

FILE: modern-best-practices-testing-java/src/test/java/com/phauer/modernunittesting/RandomizedValues.java
  class RandomizedValues (line 10) | public class RandomizedValues {
    method randomized (line 12) | @Test
    method fixed (line 22) | @Test

FILE: modern-integration-testing/src/main/java/com/phauer/modernunittesting/MainLayout.java
  class MainLayout (line 8) | @Push

FILE: modern-integration-testing/src/main/java/com/phauer/modernunittesting/ModernUnitTestingApplication.java
  class ModernUnitTestingApplication (line 6) | @SpringBootApplication
    method main (line 9) | public static void main(String[] args) {

FILE: modern-integration-testing/src/main/java/com/phauer/modernunittesting/PriceCalculator.java
  class PriceCalculator (line 5) | @Component

FILE: modern-integration-testing/src/main/java/com/phauer/modernunittesting/ProductController.java
  class ProductController (line 9) | @RestController
    method ProductController (line 14) | public ProductController(ProductDAO dao, TaxServiceClient client, Pric...
    method getProducts (line 18) | @GetMapping("/products")
    method toDto (line 24) | private List<ProductDTO> toDto(List<ProductEntity> products) {
    method toDto (line 30) | private ProductDTO toDto(ProductEntity entity) {

FILE: modern-integration-testing/src/main/java/com/phauer/modernunittesting/ProductDAO.java
  class ProductDAO (line 10) | @Component
    method ProductDAO (line 15) | public ProductDAO(JdbcTemplate template) {
    method findProducts (line 19) | public List<ProductEntity> findProducts() {
    method map (line 23) | private ProductEntity map(ResultSet resultSet, int i) throws SQLExcept...

FILE: modern-integration-testing/src/main/java/com/phauer/modernunittesting/ProductDTO.java
  class ProductDTO (line 6) | public class ProductDTO {
    method getPrice (line 11) | public double getPrice() {
    method setPrice (line 15) | public ProductDTO setPrice(double price) {
    method getId (line 20) | public String getId() {
    method setId (line 24) | public ProductDTO setId(String id) {
    method getName (line 29) | public String getName() {
    method setName (line 33) | public ProductDTO setName(String name) {
    method toString (line 38) | @Override
    method equals (line 47) | @Override
    method hashCode (line 57) | @Override

FILE: modern-integration-testing/src/main/java/com/phauer/modernunittesting/ProductEntity.java
  class ProductEntity (line 6) | public class ProductEntity {
    method getId (line 10) | public String getId() {
    method setId (line 14) | public ProductEntity setId(String id) {
    method getName (line 19) | public String getName() {
    method setName (line 23) | public ProductEntity setName(String name) {
    method equals (line 28) | @Override
    method hashCode (line 37) | @Override
    method toString (line 42) | @Override

FILE: modern-integration-testing/src/main/java/com/phauer/modernunittesting/ProductModel.java
  class ProductModel (line 6) | public class ProductModel {
    method getId (line 10) | public String getId() {
    method setId (line 14) | public ProductModel setId(String id) {
    method getName (line 19) | public String getName() {
    method setName (line 23) | public ProductModel setName(String name) {
    method equals (line 28) | @Override
    method hashCode (line 37) | @Override
    method toString (line 42) | @Override

FILE: modern-integration-testing/src/main/java/com/phauer/modernunittesting/ProductView.java
  class ProductView (line 13) | @Route(value = "", layout = MainLayout.class)
    method ProductView (line 21) | public ProductView(ProductDAO dao) {
    method initView (line 26) | private void initView() {
    method loadButtonHandler (line 35) | private void loadButtonHandler(ClickEvent event) {
    method toModel (line 40) | private List<ProductModel> toModel(List<ProductEntity> products) {
    method toModel (line 46) | private ProductModel toModel(ProductEntity entity) {

FILE: modern-integration-testing/src/main/java/com/phauer/modernunittesting/SchemaCreator.java
  class SchemaCreator (line 8) | @Component
    method SchemaCreator (line 13) | public SchemaCreator(JdbcTemplate jdbcTemplate) {
    method run (line 17) | @Override
    method createSchema (line 28) | public static void createSchema(JdbcTemplate jdbcTemplate) {

FILE: modern-integration-testing/src/main/java/com/phauer/modernunittesting/TaxServiceClient.java
  class TaxServiceClient (line 5) | @Component
    method TaxServiceClient (line 7) | public TaxServiceClient() {
    method TaxServiceClient (line 10) | public TaxServiceClient(String url) {

FILE: modern-integration-testing/src/main/java/com/phauer/modernunittesting/TaxServiceResponseDTO.java
  class TaxServiceResponseDTO (line 5) | public class TaxServiceResponseDTO {
    method TaxServiceResponseDTO (line 10) | public TaxServiceResponseDTO(Locale germany, double rate) {
    method getLocale (line 14) | public String getLocale() {
    method setLocale (line 18) | public TaxServiceResponseDTO setLocale(String locale) {
    method getRate (line 23) | public double getRate() {
    method setRate (line 27) | public TaxServiceResponseDTO setRate(double rate) {

FILE: modern-integration-testing/src/test/java/com/phauer/modernunittesting/AssertJTest.java
  class AssertJTest (line 11) | public class AssertJTest {
    method bla (line 13) | @Test
    method createProductDTO (line 44) | private Product createProductDTO(String s, String smartphone, double v) {

FILE: modern-integration-testing/src/test/java/com/phauer/modernunittesting/Product.java
  class Product (line 6) | public class Product {
    method getId (line 11) | public String getId() {
    method setId (line 15) | public Product setId(String id) {
    method getDateCreated (line 20) | public Instant getDateCreated() {
    method setDateCreated (line 24) | public Product setDateCreated(Instant dateCreated) {
    method equals (line 29) | @Override
    method hashCode (line 38) | @Override

FILE: modern-integration-testing/src/test/java/com/phauer/modernunittesting/ProductControllerITest.java
  class ProductControllerITest (line 30) | @TestInstance(TestInstance.Lifecycle.PER_CLASS)
    method setup (line 37) | @BeforeAll
    method databaseDataIsCorrectlyReturned (line 67) | @Test
    method toDTOs (line 89) | private List<ProductDTO> toDTOs(String string) throws IOException {
    method insertIntoDatabase (line 95) | private void insertIntoDatabase(ProductEntity... products) {
    method toJson (line 101) | private String toJson(TaxServiceResponseDTO taxServiceResponseDTO) thr...
    method createDataSourceAndStartDatabaseIfNecessary (line 105) | private DataSource createDataSourceAndStartDatabaseIfNecessary() {
    method beforeEach (line 124) | @BeforeEach

FILE: modern-integration-testing/src/test/java/com/phauer/modernunittesting/ProductControllerITest2.java
  class ProductControllerITest2 (line 6) | @WebMvcTest(ProductController.class)
    method foo (line 9) | @Test

FILE: modern-integration-testing/src/test/java/com/phauer/modernunittesting/ProductViewITest.java
  class ProductViewITest (line 21) | @TestInstance(TestInstance.Lifecycle.PER_CLASS)
    method beforeAll (line 27) | @BeforeAll
    method beforeEach (line 42) | @BeforeEach
    method prodcutsAreCorrectlyDisplayedInTable (line 48) | @Test
    method insertIntoDatabase (line 64) | private void insertIntoDatabase(ProductEntity... products) {

FILE: mongodb-practice/local-dev/mongo-seeding/seedMongo.py
  function seed (line 11) | def seed():
  function generate_product (line 20) | def generate_product():

FILE: python-demo/1concise-powerful.py
  function divide (line 2) | def divide(a, b):

FILE: python-demo/3functions.py
  function copy (line 1) | def copy(source_file, target_file, override):
  function copy2 (line 11) | def copy2(source_file, target_file, override = True):
  function multiple_return (line 28) | def multiple_return():

FILE: python-demo/4classes.py
  class User (line 2) | class User:
    method __init__ (line 3) | def __init__(self, name, age):
    method introduce_yourself (line 7) | def introduce_yourself(self):

FILE: python-demo/5operator-overloading.py
  class User (line 13) | class User:
    method __init__ (line 14) | def __init__(self, name, age):
    method __eq__ (line 18) | def __eq__(self, other):
  class UserAgeFinder (line 24) | class UserAgeFinder:
    method __init__ (line 25) | def __init__(self):
    method __getitem__ (line 28) | def __getitem__(self, name):

FILE: rest-api-doc-jaxrs-swagger-asciidoc/src/main/java/de/philipphauer/blog/RestApiDocApplication.java
  class RestApiDocApplication (line 10) | public class RestApiDocApplication extends Application<RestApiDocConfigu...
    method main (line 12) | public static void main(final String[] args) throws Exception {
    method getName (line 16) | @Override
    method initialize (line 21) | @Override
    method run (line 25) | @Override

FILE: rest-api-doc-jaxrs-swagger-asciidoc/src/main/java/de/philipphauer/blog/RestApiDocConfiguration.java
  class RestApiDocConfiguration (line 5) | public class RestApiDocConfiguration extends Configuration {

FILE: rest-api-doc-jaxrs-swagger-asciidoc/src/main/java/de/philipphauer/blog/apiDocGen/SwaggerAndAsciiDocGenerator.java
  class SwaggerAndAsciiDocGenerator (line 23) | public class SwaggerAndAsciiDocGenerator {
    method main (line 25) | public static void main(String[] args) throws IOException {
    method createSwagger (line 36) | private static void createSwagger(Path swaggerTargetFolder) throws IOE...
    method convertSwaggerToAsciiDoc (line 57) | private static void convertSwaggerToAsciiDoc(Path swaggerTargetFolder,...

FILE: rest-api-doc-jaxrs-swagger-asciidoc/src/main/java/de/philipphauer/blog/resources/BandResource.java
  class BandResource (line 26) | @Path("/")
    method getBands (line 36) | @GET
    method getBand (line 44) | @GET
    method createBand (line 51) | @POST

FILE: rest-api-doc-jaxrs-swagger-asciidoc/src/main/java/de/philipphauer/blog/resources/CORSFilter.java
  class CORSFilter (line 9) | @Provider
    method filter (line 12) | @Override

FILE: rest-api-doc-jaxrs-swagger-asciidoc/src/main/java/de/philipphauer/blog/resources/DocumentationResource.java
  class DocumentationResource (line 14) | @Path("/")
    method swaggerJson (line 17) | @GET
    method swaggerYaml (line 24) | @GET
    method doc (line 31) | @GET
    method getFileContent (line 38) | private String getFileContent(String fileName) {

FILE: rest-api-doc-jaxrs-swagger-asciidoc/src/main/java/de/philipphauer/blog/resources/dto/BandCreationDTO.java
  class BandCreationDTO (line 7) | @ApiModel("Payload for band creation")
    method getName (line 14) | public String getName() {
    method setName (line 18) | public BandCreationDTO setName(String name) {
    method getFoundation (line 23) | public int getFoundation() {
    method setFoundation (line 27) | public BandCreationDTO setFoundation(int foundation) {
    method toString (line 32) | @Override

FILE: rest-api-doc-jaxrs-swagger-asciidoc/src/main/java/de/philipphauer/blog/resources/dto/BandRetrievalDTO.java
  class BandRetrievalDTO (line 9) | @ApiModel("Payload for band retrieval")
    method setId (line 18) | public BandRetrievalDTO setId(UUID id) {
    method getId (line 23) | public UUID getId() {
    method getName (line 27) | public String getName() {
    method setName (line 31) | public BandRetrievalDTO setName(String name) {
    method getFoundation (line 36) | public int getFoundation() {
    method setFoundation (line 40) | public BandRetrievalDTO setFoundation(int foundation) {
    method toString (line 45) | @Override

FILE: sealedclasses/service-stub/service-stub.py
  function get_design_data (line 9) | def get_design_data(user_id):

FILE: smooth-local-dev-docker/local-dev/external-service-stub/external-service-stub.py
  function get_users_faker (line 13) | def get_users_faker():
  function generate_user (line 22) | def generate_user(user_id):
  function get_users_static (line 35) | def get_users_static():

FILE: smooth-local-dev-docker/local-dev/mongo-seeding/seed-mongo.py
  class MongoSeeder (line 15) | class MongoSeeder:
    method __init__ (line 17) | def __init__(self):
    method seed (line 22) | def seed(self):
  function generate_design (line 31) | def generate_design():
  function script_runs_within_container (line 50) | def script_runs_within_container():
  function choose_max_n_times (line 55) | def choose_max_n_times(possibilities: List, max_n: int) -> List:

FILE: smooth-local-dev-docker/local-dev/mysql-seeding/seed-mysql.py
  class MySqlSeeder (line 13) | class MySqlSeeder:
    method __init__ (line 15) | def __init__(self):
    method seed (line 31) | def seed(self):
    method create_user_table (line 43) | def create_user_table(self):
    method insert_users (line 56) | def insert_users(self):
    method drop_user_table (line 71) | def drop_user_table(self):
  function script_runs_within_container (line 75) | def script_runs_within_container():

FILE: testingrestservice/integration-tests/src/test/java/de/philipphauer/blog/testingrestservice/integrationtests/BlogsTest.java
  class BlogsTest (line 23) | public class BlogsTest {
    method collectionResourceOK (line 29) | @Test
    method initSpec (line 46) | @BeforeClass
    method useSpec (line 55) | @Test
    method createBlogAndCheckExistence (line 66) | @Test
    method createBlogAndCheckExistenceReadable (line 115) | @Test
    method createDummyBlog (line 123) | private BlogDTO createDummyBlog() {
    method createResource (line 131) | private String createResource(String path, Object bodyPayload) {
    method getResource (line 143) | private <T> T getResource(String locationHeader, Class<T> responseClas...
    method assertEqualBlog (line 153) | private void assertEqualBlog(BlogDTO newBlog, BlogDTO retrievedBlog) {
    method assertEqualBlog2 (line 162) | private void assertEqualBlog2(BlogDTO newBlog, BlogDTO retrievedBlog) {
    method getAllBlogsWithMapping (line 172) | @Test
    method getAllBlogsWithJsonPath (line 188) | @Test
    method createBlogAndCheckInList (line 215) | @Test
    method jsonPath (line 259) | @Test
    method extractId (line 266) | private int extractId(String resourceLocation) {
    method waitAndPoll (line 275) | @Test
    method sendAsyncEventThatChangesABlog (line 287) | private void sendAsyncEventThatChangesABlog(int i) {
    method waitAndPoll2 (line 295) | @Test
    method test (line 305) | @Test

FILE: testingrestservice/integration-tests/src/test/java/de/philipphauer/blog/testingrestservice/integrationtests/dto/BlogDTO.java
  class BlogDTO (line 5) | @JsonIgnoreProperties(ignoreUnknown = true)
    method BlogDTO (line 13) | public BlogDTO() {}
    method BlogDTO (line 16) | public BlogDTO(String name, String description, String url) {
    method getName (line 22) | public String getName() {
    method setName (line 26) | public BlogDTO setName(String name) {
    method getDescription (line 31) | public String getDescription() {
    method setDescription (line 35) | public BlogDTO setDescription(String description) {
    method getUrl (line 40) | public String getUrl() {
    method setUrl (line 44) | public BlogDTO setUrl(String url) {

FILE: testingrestservice/integration-tests/src/test/java/de/philipphauer/blog/testingrestservice/integrationtests/dto/BlogListDTO.java
  class BlogListDTO (line 7) | @JsonIgnoreProperties(ignoreUnknown = true)
    class BlogReference (line 14) | public static class BlogReference{

FILE: testingrestservice/service/src/main/java/de/philipphauer/blog/testingrestservice/service/BlogApplication.java
  class BlogApplication (line 8) | @SpringBootApplication
    method main (line 13) | public static void main(String[] args) {

FILE: testingrestservice/service/src/main/java/de/philipphauer/blog/testingrestservice/service/dataaccess/BlogRepository.java
  type BlogRepository (line 6) | public interface BlogRepository extends CrudRepository<BlogEntity, Long> {

FILE: testingrestservice/service/src/main/java/de/philipphauer/blog/testingrestservice/service/dataaccess/DatabaseInitializer.java
  class DatabaseInitializer (line 20) | @Component
    method run (line 29) | @Override
    method createComments (line 37) | private List<CommentEntity> createComments(int amount) {
    method createPosts (line 47) | private List<PostEntity> createPosts(int amount) {
    method createBlogs (line 68) | private List<BlogEntity> createBlogs(int amount) {
    method createRandomName (line 87) | private String createRandomName() {
    method createRandomCommentText (line 95) | private String createRandomCommentText() {
    method createRandomPostTitle (line 103) | private String createRandomPostTitle() {
    method createRandomBlogTitle (line 112) | private String createRandomBlogTitle() {
    method getRandomElement (line 116) | private String getRandomElement(List<String> list) {
    method createRandomTags (line 122) | private String[] createRandomTags() {
    method toSlug (line 127) | public String toSlug(String blogTitle){

FILE: testingrestservice/service/src/main/java/de/philipphauer/blog/testingrestservice/service/dataaccess/PostRepository.java
  type PostRepository (line 6) | public interface PostRepository extends CrudRepository<PostEntity, Long> {

FILE: testingrestservice/service/src/main/java/de/philipphauer/blog/testingrestservice/service/dataaccess/entities/BlogEntity.java
  class BlogEntity (line 7) | @Entity
    method getId (line 20) | public long getId() {
    method setId (line 24) | public BlogEntity setId(long id) {
    method getName (line 29) | public String getName() {
    method setName (line 33) | public BlogEntity setName(String name) {
    method getDescription (line 38) | public String getDescription() {
    method setDescription (line 42) | public BlogEntity setDescription(String description) {
    method getPosts (line 47) | public List<PostEntity> getPosts() {
    method setPosts (line 51) | public BlogEntity setPosts(List<PostEntity> posts) {
    method getUrl (line 56) | public String getUrl() {
    method setUrl (line 60) | public BlogEntity setUrl(String url) {

FILE: testingrestservice/service/src/main/java/de/philipphauer/blog/testingrestservice/service/dataaccess/entities/CommentEntity.java
  class CommentEntity (line 6) | @Entity
    method getId (line 17) | public long getId() {
    method setId (line 21) | public CommentEntity setId(long id) {
    method getCreatedDateTime (line 26) | public LocalDateTime getCreatedDateTime() {
    method setCreatedDateTime (line 30) | public CommentEntity setCreatedDateTime(LocalDateTime createdDateTime) {
    method getAuthor (line 35) | public String getAuthor() {
    method setAuthor (line 39) | public CommentEntity setAuthor(String author) {
    method getContent (line 44) | public String getContent() {
    method setContent (line 48) | public CommentEntity setContent(String content) {

FILE: testingrestservice/service/src/main/java/de/philipphauer/blog/testingrestservice/service/dataaccess/entities/PostEntity.java
  class PostEntity (line 8) | @Entity
    method getTags (line 28) | public String[] getTags() {
    method setTags (line 32) | public PostEntity setTags(String[] tags) {
    method getFeaturedImage (line 37) | public String getFeaturedImage() {
    method setFeaturedImage (line 41) | public PostEntity setFeaturedImage(String featuredImage) {
    method getViewCount (line 46) | public int getViewCount() {
    method setViewCount (line 50) | public PostEntity setViewCount(int viewCount) {
    method getSlug (line 55) | public String getSlug() {
    method setSlug (line 59) | public PostEntity setSlug(String slug) {
    method getId (line 64) | public long getId() {
    method setId (line 68) | public PostEntity setId(long id) {
    method getCreatedDateTime (line 73) | public LocalDateTime getCreatedDateTime() {
    method setCreatedDateTime (line 77) | public PostEntity setCreatedDateTime(LocalDateTime createdDateTime) {
    method getTitle (line 82) | public String getTitle() {
    method setTitle (line 86) | public PostEntity setTitle(String title) {
    method getTeaser (line 91) | public String getTeaser() {
    method setTeaser (line 95) | public PostEntity setTeaser(String teaser) {
    method getContent (line 100) | public String getContent() {
    method setContent (line 104) | public PostEntity setContent(String content) {
    method getComments (line 109) | public List<CommentEntity> getComments() {
    method setComments (line 113) | public PostEntity setComments(List<CommentEntity> comments) {
    method getAuthor (line 118) | public String getAuthor() {
    method setAuthor (line 122) | public PostEntity setAuthor(String author) {

FILE: testingrestservice/service/src/main/java/de/philipphauer/blog/testingrestservice/service/rest/BlogsResource.java
  class BlogsResource (line 23) | @RestController
    method createBlog (line 32) | @RequestMapping(value = "", method = RequestMethod.POST)
    method mapToEntry (line 44) | private BlogEntity mapToEntry(BlogDTO blogDto) {
    method getAll (line 51) | @RequestMapping(value = "", method = RequestMethod.GET)
    method getBlog (line 58) | @RequestMapping(value = "/{id}", method = RequestMethod.GET)
    method getAllBlogPosts (line 65) | @RequestMapping(value = "/{blogId}/posts", method = RequestMethod.GET)
    method getBlogPost (line 73) | @RequestMapping(value = "/{blogId}/posts/{postId}", method = RequestMe...
    method mapToDTO (line 79) | private BlogDTO mapToDTO(BlogEntity blog) {
    method mapToDTO (line 90) | private List<ReferenceDTO> mapToDTO(long blogId, List<PostEntity> post...
    method mapToDTO (line 96) | private ReferenceDTO mapToDTO(long blogId, PostEntity post){
    method mapToDTO (line 104) | private BlogsDTO mapToDTO(Collection<BlogEntity> blogs) {

FILE: testingrestservice/service/src/main/java/de/philipphauer/blog/testingrestservice/service/rest/dto/BlogDTO.java
  class BlogDTO (line 5) | public class BlogDTO {
    method getUrl (line 12) | public String getUrl() {
    method setUrl (line 16) | public BlogDTO setUrl(String url) {
    method getName (line 21) | public String getName() {
    method setName (line 25) | public BlogDTO setName(String name) {
    method getDescription (line 30) | public String getDescription() {
    method setDescription (line 34) | public BlogDTO setDescription(String description) {
    method getPosts (line 39) | public List<ReferenceDTO> getPosts() {
    method setPosts (line 43) | public BlogDTO setPosts(List<ReferenceDTO> posts) {

FILE: testingrestservice/service/src/main/java/de/philipphauer/blog/testingrestservice/service/rest/dto/BlogsDTO.java
  class BlogsDTO (line 5) | public class BlogsDTO {
    method getBlogs (line 12) | public List<ReferenceDTO> getBlogs() {
    method getCount (line 16) | public int getCount() {
    method getOffset (line 20) | public int getOffset() {
    method getLimit (line 24) | public int getLimit() {
    method setBlogs (line 28) | public BlogsDTO setBlogs(List<ReferenceDTO> blogs) {
    method setCount (line 33) | public BlogsDTO setCount(int count) {
    method setOffset (line 38) | public BlogsDTO setOffset(int offset) {
    method setLimit (line 43) | public BlogsDTO setLimit(int limit) {

FILE: testingrestservice/service/src/main/java/de/philipphauer/blog/testingrestservice/service/rest/dto/ReferenceDTO.java
  class ReferenceDTO (line 3) | public class ReferenceDTO {
    method getName (line 9) | public String getName() {
    method setName (line 13) | public ReferenceDTO setName(String name) {
    method getId (line 18) | public long getId() {
    method setId (line 22) | public ReferenceDTO setId(long id) {
    method getHref (line 27) | public String getHref() {
    method setHref (line 31) | public ReferenceDTO setHref(String href) {

FILE: testingrestservice/service/src/main/java/de/philipphauer/blog/testingrestservice/service/servicecall/ImageReference.java
  class ImageReference (line 3) | public class ImageReference {
    method getId (line 8) | public String getId() {
    method setId (line 12) | public ImageReference setId(String id) {
    method getHref (line 18) | public String getHref() {
    method setHref (line 22) | public ImageReference setHref(String href) {

FILE: testingrestservice/service/src/main/java/de/philipphauer/blog/testingrestservice/service/servicecall/ImageServiceClient.java
  class ImageServiceClient (line 8) | public class ImageServiceClient {
    method ImageServiceClient (line 13) | public ImageServiceClient(String imageServiceHost, int imageServicePor...
    method requestImage (line 18) | public ImageReference requestImage(String id){

FILE: testingrestservice/service/src/test/java/de/philipphauer/blog/testingrestservice/service/servicecall/ImageReferenceServiceClientTest.java
  class ImageReferenceServiceClientTest (line 15) | public class ImageReferenceServiceClientTest {
    method init (line 20) | @Before
    method requestImage (line 28) | @Test

FILE: ti-continuation-token/src/main/resources/create-designs-table.sql
  type designs (line 1) | CREATE TABLE designs (

FILE: uuid-mysql-hibernate/src/main/java/de/philipphauer/blog/ProductsResource.java
  class ProductsResource (line 16) | @RestController
    method createProduct (line 23) | @Transactional
    method getProducts (line 31) | @Transactional

FILE: uuid-mysql-hibernate/src/main/java/de/philipphauer/blog/UuidMysqlHibernateApplication.java
  class UuidMysqlHibernateApplication (line 6) | @SpringBootApplication
    method main (line 9) | public static void main(String[] args) {

FILE: uuid-mysql-hibernate/src/main/java/de/philipphauer/blog/model/Product.java
  class Product (line 11) | @Entity
    method getId (line 22) | public UUID getId() {
    method setId (line 26) | public Product setId(UUID id) {
    method getName (line 31) | public String getName() {
    method setName (line 35) | public Product setName(String name) {

FILE: vaadin-10-sass-cssrefresh/src/main/java/com/phauer/vaadin10sasscssrefresh/CustomVaadinServiceListener.java
  class CustomVaadinServiceListener (line 10) | @Component
    method serviceInit (line 12) | @Override
    class CustomBootstrapListener (line 18) | static class CustomBootstrapListener implements BootstrapListener {
      method modifyBootstrapPage (line 19) | @Override

FILE: vaadin-10-sass-cssrefresh/src/main/java/com/phauer/vaadin10sasscssrefresh/ExampleView.java
  class ExampleView (line 10) | @Route(value = "", layout = MainLayout.class)
    method ExampleView (line 13) | public ExampleView(){
    method addLabelToView (line 21) | private void addLabelToView(ClickEvent<Button> event) {

FILE: vaadin-10-sass-cssrefresh/src/main/java/com/phauer/vaadin10sasscssrefresh/MainLayout.java
  class MainLayout (line 9) | @Push
    method MainLayout (line 13) | public MainLayout() {

FILE: vaadin-10-sass-cssrefresh/src/main/java/com/phauer/vaadin10sasscssrefresh/Vaadin10SassCssrefreshApplication.java
  class Vaadin10SassCssrefreshApplication (line 6) | @SpringBootApplication
    method main (line 9) | public static void main(String[] args) {

FILE: vaadin-10-sass-cssrefresh/src/main/resources/META-INF/resources/js/cssrefresh.js
  function cssRefresh (line 2) | function cssRefresh(link) {

FILE: versioning-continuous-delivery/src/main/java/de/philipphauer/blog/VersioningContinuousDeliveryApplication.java
  class VersioningContinuousDeliveryApplication (line 8) | @SpringBootApplication
    method main (line 12) | public static void main(String[] args) {
    method ping (line 16) | @RequestMapping("/")
Condensed preview — 363 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (577K chars).
[
  {
    "path": "README.md",
    "chars": 15,
    "preview": "# blog-related\n"
  },
  {
    "path": "cairosvg-on-alpine/.gitignore",
    "chars": 8,
    "preview": ".vscode/"
  },
  {
    "path": "cairosvg-on-alpine/Pipfile",
    "chars": 188,
    "preview": "[[source]]\n\nurl = \"https://pypi.python.org/simple\"\nverify_ssl = true\nname = \"pypi\"\n\n[packages]\n\nflask = \"==0.12.2\"\nCairo"
  },
  {
    "path": "cairosvg-on-alpine/README.md",
    "chars": 757,
    "preview": "# Alpine Image with CairoSVG\n\n```bash\n# build and start the docker container\ndocker-compose up\n# trigger the svg convert"
  },
  {
    "path": "cairosvg-on-alpine/docker-compose.yml",
    "chars": 95,
    "preview": "version: '3'\nservices:\n  svg-converter-service:\n    build: ./src\n    ports:\n      - \"5000:5000\""
  },
  {
    "path": "cairosvg-on-alpine/src/Dockerfile",
    "chars": 345,
    "preview": "FROM python:3.6.4-alpine3.7\n\nRUN apk add --no-cache \\\n    build-base cairo-dev cairo cairo-tools \\\n    # pillow dependen"
  },
  {
    "path": "cairosvg-on-alpine/src/svg-converter-service.py",
    "chars": 333,
    "preview": "import cairosvg\nfrom flask import Flask, Response\n\napp = Flask(__name__)\n\n@app.route('/image')\ndef convert_image():\n    "
  },
  {
    "path": "cleaner-code-with-kotlin/.gitignore",
    "chars": 20,
    "preview": ".idea/\ntarget/\n*.iml"
  },
  {
    "path": "cleaner-code-with-kotlin/pom.xml",
    "chars": 4782,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www"
  },
  {
    "path": "cleaner-code-with-kotlin/src/main/kotlin/functions/BeAware.kt",
    "chars": 468,
    "preview": "package functions\n\nfun add(value: String?){\n    val map = mutableMapOf<String, String>()\n\n\nvalue?.emptyToNull()?.let { m"
  },
  {
    "path": "cleaner-code-with-kotlin/src/main/kotlin/functions/Expressions.kt",
    "chars": 701,
    "preview": "package functions\n\nimport org.json.JSONException\nimport org.json.JSONObject\n\nval url = \"http://bla.de?asdf\"\n\nval delimit"
  },
  {
    "path": "cleaner-code-with-kotlin/src/main/kotlin/functions/Immutability.kt",
    "chars": 598,
    "preview": "package functions\n\nfun varVal(){\n\n    val id = 1\n    // id = 2\n\n    var id2 = 1\n    id2 = 2\n\n    println(id)\n    println"
  },
  {
    "path": "cleaner-code-with-kotlin/src/main/kotlin/functions/Nullability.kt",
    "chars": 2034,
    "preview": "package functions\n\nval value: String = \"Clean Code\"\n//val value2: String = null\n\nval nullValue: String? = \"Clean Code\"\nv"
  },
  {
    "path": "cleaner-code-with-kotlin/src/main/kotlin/functions/ProductClient.java",
    "chars": 1016,
    "preview": "package functions;\n\nimport okhttp3.Response;\nimport okhttp3.ResponseBody;\n\npublic class ProductClient {\n\n    public Prod"
  },
  {
    "path": "cleaner-code-with-kotlin/src/main/kotlin/functions/ProductClientKotlin.kt",
    "chars": 1236,
    "preview": "package functions\n\nimport functions.ProductClient.Product\nimport functions.ProductClient.ProductClientException\nimport o"
  },
  {
    "path": "compare-payloads/.gitignore",
    "chars": 48,
    "preview": "target\n.idea\n*iml\ncompare-scripts/payload-output"
  },
  {
    "path": "compare-payloads/README.md",
    "chars": 201,
    "preview": "```\n$ mvn package\n$ java -jar target/compare-payloads_1.jar # TODO\n$ cd compare-scripts\n$ sudo apt install httpie libxml"
  },
  {
    "path": "compare-payloads/compare-scripts/compare-all-final.sh",
    "chars": 1550,
    "preview": "#!/usr/bin/env bash\n\nif [ -z \"$2\" ]; then\n    fileName=$(basename \"$0\")\n    printf \"Paths are not provided! Pattern: \\n."
  },
  {
    "path": "compare-payloads/compare-scripts/compare-by-sorting.sh",
    "chars": 785,
    "preview": "#!/usr/bin/env bash\n\nif [[ ! -e \"payload-output\" ]]; then\n    mkdir \"payload-output\"\nfi\n\nhttp http://localhost:8080/blog"
  },
  {
    "path": "compare-payloads/compare-scripts/compare-json-payload.sh",
    "chars": 337,
    "preview": "#!/usr/bin/env bash\n\nif [[ ! -e \"payload-output\" ]]; then\n    mkdir \"payload-output\"\nfi\n\nhttp http://localhost:8080/blog"
  },
  {
    "path": "compare-payloads/compare-scripts/compare-xml-payload.sh",
    "chars": 522,
    "preview": "#!/usr/bin/env bash\n\nif [[ ! -e \"payload-output\" ]]; then\n    mkdir \"payload-output\"\nfi\n\nhttp http://localhost:8080/blog"
  },
  {
    "path": "compare-payloads/pom.xml",
    "chars": 1708,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2"
  },
  {
    "path": "compare-payloads/src/main/java/de/philipphauer/blog/BlogPost.java",
    "chars": 797,
    "preview": "package de.philipphauer.blog;\n\nimport javax.xml.bind.annotation.XmlRootElement;\nimport java.time.Instant;\nimport java.ti"
  },
  {
    "path": "compare-payloads/src/main/java/de/philipphauer/blog/BlogPost2.java",
    "chars": 736,
    "preview": "package de.philipphauer.blog;\n\nimport javax.xml.bind.annotation.XmlRootElement;\n\npublic class BlogPost2 {\n\n    private S"
  },
  {
    "path": "compare-payloads/src/main/java/de/philipphauer/blog/ComparePayloadApplication.java",
    "chars": 2262,
    "preview": "package de.philipphauer.blog;\n\nimport org.springframework.boot.SpringApplication;\nimport org.springframework.boot.autoco"
  },
  {
    "path": "compare-payloads/src/main/resources/application.properties",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "continuation-token/.gitignore",
    "chars": 13,
    "preview": ".idea/\n*.iml\n"
  },
  {
    "path": "continuation-token/README.md",
    "chars": 461,
    "preview": "# REST API Pagination Example Application\n\n# Getting Started\n\n```bash\ncd continuation-token\n./mvnw install\ncd ../demo-ko"
  },
  {
    "path": "continuation-token/continuation-token/.gitignore",
    "chars": 52,
    "preview": "target/\n!.mvn/wrapper/maven-wrapper.jar\n.idea/\n*.iml"
  },
  {
    "path": "continuation-token/continuation-token/.mvn/wrapper/maven-wrapper.properties",
    "chars": 110,
    "preview": "distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.2/apache-maven-3.5.2-bin.zip\n"
  },
  {
    "path": "continuation-token/continuation-token/mvnw",
    "chars": 6468,
    "preview": "#!/bin/sh\n# ----------------------------------------------------------------------------\n# Licensed to the Apache Softwa"
  },
  {
    "path": "continuation-token/continuation-token/mvnw.cmd",
    "chars": 4994,
    "preview": "@REM ----------------------------------------------------------------------------\n@REM Licensed to the Apache Software F"
  },
  {
    "path": "continuation-token/continuation-token/pom.xml",
    "chars": 4937,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2"
  },
  {
    "path": "continuation-token/continuation-token/src/main/kotlin/de/philipphauer/blog/pagination/ContinuationTokenParser.kt",
    "chars": 662,
    "preview": "package de.philipphauer.blog.pagination\n\nobject ContinuationTokenParser {\n    val DELIMITER = \":\"\n\n    fun parse(tokenSt"
  },
  {
    "path": "continuation-token/continuation-token/src/main/kotlin/de/philipphauer/blog/pagination/Model.kt",
    "chars": 998,
    "preview": "package de.philipphauer.blog.pagination\n\nimport de.philipphauer.blog.pagination.ContinuationTokenParser.DELIMITER\n\n/** a"
  },
  {
    "path": "continuation-token/continuation-token/src/main/kotlin/de/philipphauer/blog/pagination/Pagination.kt",
    "chars": 3690,
    "preview": "package de.philipphauer.blog.pagination\n\nimport java.util.zip.CRC32\n\nobject Pagination{\n\n    //TODO implement checksum f"
  },
  {
    "path": "continuation-token/continuation-token/src/test/kotlin/de/philipphauer/blog/pagination/ContinuationTokenParserTest.kt",
    "chars": 1781,
    "preview": "package de.philipphauer.blog.pagination\n\nimport org.assertj.core.api.Assertions.assertThat\nimport org.junit.jupiter.api."
  },
  {
    "path": "continuation-token/continuation-token/src/test/kotlin/de/philipphauer/blog/pagination/PaginationTest.kt",
    "chars": 23363,
    "preview": "package de.philipphauer.blog.pagination\n\nimport org.assertj.core.api.Assertions.assertThat\nimport org.junit.jupiter.api."
  },
  {
    "path": "continuation-token/demo-kotlin/.gitignore",
    "chars": 79,
    "preview": "target/\n!.mvn/wrapper/maven-wrapper.jar\n.idea/\n*.iml\ndependency-reduced-pom.xml"
  },
  {
    "path": "continuation-token/demo-kotlin/.mvn/wrapper/maven-wrapper.properties",
    "chars": 110,
    "preview": "distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.2/apache-maven-3.5.2-bin.zip\n"
  },
  {
    "path": "continuation-token/demo-kotlin/mvnw",
    "chars": 6468,
    "preview": "#!/bin/sh\n# ----------------------------------------------------------------------------\n# Licensed to the Apache Softwa"
  },
  {
    "path": "continuation-token/demo-kotlin/mvnw.cmd",
    "chars": 4994,
    "preview": "@REM ----------------------------------------------------------------------------\n@REM Licensed to the Apache Software F"
  },
  {
    "path": "continuation-token/demo-kotlin/pom.xml",
    "chars": 5209,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2"
  },
  {
    "path": "continuation-token/demo-kotlin/src/main/kotlin/de/philipphauer/blog/DesignDAO.kt",
    "chars": 1327,
    "preview": "package de.philipphauer.blog\n\nimport de.philipphauer.blog.pagination.ContinuationToken\nimport de.philipphauer.blog.pagin"
  },
  {
    "path": "continuation-token/demo-kotlin/src/main/kotlin/de/philipphauer/blog/DesignEntity.kt",
    "chars": 348,
    "preview": "package de.philipphauer.blog\n\nimport de.philipphauer.blog.pagination.Pageable\nimport java.time.Instant\n\ndata class Desig"
  },
  {
    "path": "continuation-token/demo-kotlin/src/main/kotlin/de/philipphauer/blog/DesignResource.kt",
    "chars": 1540,
    "preview": "package de.philipphauer.blog\n\nimport com.fasterxml.jackson.module.kotlin.jacksonObjectMapper\nimport de.philipphauer.blog"
  },
  {
    "path": "continuation-token/demo-kotlin/src/main/kotlin/de/philipphauer/blog/Main.kt",
    "chars": 1365,
    "preview": "package de.philipphauer.blog\n\nimport de.philipphauer.blog.util.DesignCreator\nimport de.philipphauer.blog.util.FunctionsM"
  },
  {
    "path": "continuation-token/demo-kotlin/src/main/kotlin/de/philipphauer/blog/util/DesignCreator.kt",
    "chars": 675,
    "preview": "package de.philipphauer.blog.util\n\nimport org.springframework.jdbc.core.JdbcTemplate\nimport java.time.Instant\nimport jav"
  },
  {
    "path": "continuation-token/demo-kotlin/src/main/kotlin/de/philipphauer/blog/util/FunctionsMySQL.kt",
    "chars": 4746,
    "preview": "package de.philipphauer.blog.util\n\nimport org.h2.util.StringUtils\nimport java.sql.Connection\nimport java.sql.SQLExceptio"
  },
  {
    "path": "continuation-token/demo-kotlin/src/main/resources/create-designs-table.sql",
    "chars": 161,
    "preview": "CREATE TABLE designs (\n  id int AUTO_INCREMENT PRIMARY KEY,\n  title varchar(100) NOT NULL,\n  imageUrl varchar(100) NOT N"
  },
  {
    "path": "continuation-token/demo-kotlin/src/test/kotlin/de/philipphauer/blog/DesignResourceTest.kt",
    "chars": 2105,
    "preview": "package de.philipphauer.blog\n\nimport com.fasterxml.jackson.databind.DeserializationFeature\nimport com.fasterxml.jackson."
  },
  {
    "path": "development-productivity-vaadin-spring-boot/.gitignore",
    "chars": 408,
    "preview": "target/\n!.mvn/wrapper/maven-wrapper.jar\n\n### STS ###\n.apt_generated\n.classpath\n.factorypath\n.project\n.settings\n.springBe"
  },
  {
    "path": "development-productivity-vaadin-spring-boot/.mvn/wrapper/maven-wrapper.properties",
    "chars": 110,
    "preview": "distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.0/apache-maven-3.5.0-bin.zip\n"
  },
  {
    "path": "development-productivity-vaadin-spring-boot/Makefile",
    "chars": 262,
    "preview": ".PHONY: all watch\n\nSHELL:=/bin/bash\nBROWSERSYNC:=/usr/local/bin/browser-sync\nall: watch\n\nwatch: $(BROWSERSYNC)\n\tbrowser-"
  },
  {
    "path": "development-productivity-vaadin-spring-boot/README.md",
    "chars": 1682,
    "preview": "An example application with some bootstrapping (spring security, JDBC auto configuration, h2 console, actuator endpoints"
  },
  {
    "path": "development-productivity-vaadin-spring-boot/mvnw",
    "chars": 6468,
    "preview": "#!/bin/sh\n# ----------------------------------------------------------------------------\n# Licensed to the Apache Softwa"
  },
  {
    "path": "development-productivity-vaadin-spring-boot/mvnw.cmd",
    "chars": 4994,
    "preview": "@REM ----------------------------------------------------------------------------\n@REM Licensed to the Apache Software F"
  },
  {
    "path": "development-productivity-vaadin-spring-boot/pom.xml",
    "chars": 3466,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2"
  },
  {
    "path": "development-productivity-vaadin-spring-boot/src/main/java/de/philipphauer/blog/devproductivity/DevProductivityApplication.java",
    "chars": 346,
    "preview": "package de.philipphauer.blog.devproductivity;\n\nimport org.springframework.boot.SpringApplication;\nimport org.springframe"
  },
  {
    "path": "development-productivity-vaadin-spring-boot/src/main/java/de/philipphauer/blog/devproductivity/WebSecurityConfiguration.java",
    "chars": 707,
    "preview": "package de.philipphauer.blog.devproductivity;\n\nimport org.springframework.context.annotation.Configuration;\nimport org.s"
  },
  {
    "path": "development-productivity-vaadin-spring-boot/src/main/java/de/philipphauer/blog/devproductivity/model/Role.java",
    "chars": 101,
    "preview": "package de.philipphauer.blog.devproductivity.model;\n\npublic enum Role {\n    GUEST, REGISTERED_USER\n}\n"
  },
  {
    "path": "development-productivity-vaadin-spring-boot/src/main/java/de/philipphauer/blog/devproductivity/model/User.java",
    "chars": 1165,
    "preview": "package de.philipphauer.blog.devproductivity.model;\n\npublic class User {\n    private int id;\n    private String firstNam"
  },
  {
    "path": "development-productivity-vaadin-spring-boot/src/main/java/de/philipphauer/blog/devproductivity/rest/AdminResource.java",
    "chars": 528,
    "preview": "package de.philipphauer.blog.devproductivity.rest;\n\nimport org.springframework.stereotype.Controller;\nimport org.springf"
  },
  {
    "path": "development-productivity-vaadin-spring-boot/src/main/java/de/philipphauer/blog/devproductivity/ui/MyAppUI.java",
    "chars": 1799,
    "preview": "package de.philipphauer.blog.devproductivity.ui;\n\nimport com.vaadin.annotations.Theme;\nimport com.vaadin.server.VaadinRe"
  },
  {
    "path": "development-productivity-vaadin-spring-boot/src/main/resources/application.properties",
    "chars": 726,
    "preview": "# but I prefer to control this via program arguments in my IDE's run configuration\nvaadin.servlet.production-mode=false\n"
  },
  {
    "path": "development-productivity-vaadin-spring-boot/src/main/webapp/VAADIN/themes/mytheme/addons.scss",
    "chars": 230,
    "preview": "/* This file is automatically managed and will be overwritten from time to time. */\n/* Do not manually edit this file. *"
  },
  {
    "path": "development-productivity-vaadin-spring-boot/src/main/webapp/VAADIN/themes/mytheme/mytheme.scss",
    "chars": 160,
    "preview": "@import \"../valo/valo.scss\";\n\n@mixin mytheme {\n  @include valo;\n\n  .monospace {\n    font-family: monospace;\n  }\n\n  //div"
  },
  {
    "path": "development-productivity-vaadin-spring-boot/src/main/webapp/VAADIN/themes/mytheme/styles.scss",
    "chars": 89,
    "preview": "@import \"addons\";\n@import \"mytheme\";\n\n.mytheme {\n  @include addons;\n  @include mytheme;\n}"
  },
  {
    "path": "dont-use-in-memory-databases-tests/db-container-managed-by-gradle/.gitignore",
    "chars": 33,
    "preview": ".gradle/\n.idea/\nout/\nbuild/\n*.iml"
  },
  {
    "path": "dont-use-in-memory-databases-tests/db-container-managed-by-gradle/build.gradle",
    "chars": 883,
    "preview": "plugins {\n    id \"com.chrisgahlert.gradle-dcompose-plugin\" version \"0.9.1\"\n    id 'org.springframework.boot' version '1."
  },
  {
    "path": "dont-use-in-memory-databases-tests/db-container-managed-by-gradle/docker-compose.yml",
    "chars": 169,
    "preview": "version: '2'\nservices:\n  mysql:\n    image: mysql:5.5.53\n    ports:\n      - \"3306:3306\"\n    environment:\n      MYSQL_ROOT"
  },
  {
    "path": "dont-use-in-memory-databases-tests/db-container-managed-by-gradle/gradle/wrapper/gradle-wrapper.properties",
    "chars": 231,
    "preview": "#Fri Aug 18 18:26:51 CEST 2017\ndistributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\nzipStoreBase=GRADLE_USER"
  },
  {
    "path": "dont-use-in-memory-databases-tests/db-container-managed-by-gradle/gradlew",
    "chars": 5296,
    "preview": "#!/usr/bin/env sh\n\n##############################################################################\n##\n##  Gradle start up"
  },
  {
    "path": "dont-use-in-memory-databases-tests/db-container-managed-by-gradle/gradlew.bat",
    "chars": 2176,
    "preview": "@if \"%DEBUG%\" == \"\" @echo off\n@rem ##########################################################################\n@rem\n@rem "
  },
  {
    "path": "dont-use-in-memory-databases-tests/db-container-managed-by-gradle/settings.gradle",
    "chars": 53,
    "preview": "rootProject.name = 'db-container-managed-by-gradle'\n\n"
  },
  {
    "path": "dont-use-in-memory-databases-tests/db-container-managed-by-gradle/src/test/java/de/philipphauer/blog/MyTest.java",
    "chars": 1829,
    "preview": "package de.philipphauer.blog;\n\nimport org.junit.BeforeClass;\nimport org.junit.Test;\nimport org.springframework.boot.auto"
  },
  {
    "path": "dont-use-in-memory-databases-tests/db-container-managed-by-maven/.gitignore",
    "chars": 14,
    "preview": ".idea/\ntarget/"
  },
  {
    "path": "dont-use-in-memory-databases-tests/db-container-managed-by-maven/docker-compose.yml",
    "chars": 169,
    "preview": "version: '2'\nservices:\n  mysql:\n    image: mysql:5.5.53\n    ports:\n      - \"3306:3306\"\n    environment:\n      MYSQL_ROOT"
  },
  {
    "path": "dont-use-in-memory-databases-tests/db-container-managed-by-maven/pom.xml",
    "chars": 5062,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www"
  },
  {
    "path": "dont-use-in-memory-databases-tests/db-container-managed-by-maven/src/test/java/de/philipphauer/blog/MyIT.java",
    "chars": 1802,
    "preview": "package de.philipphauer.blog;\n\nimport org.junit.BeforeClass;\nimport org.junit.Test;\nimport org.springframework.boot.auto"
  },
  {
    "path": "dont-use-in-memory-databases-tests/db-container-managed-by-the-test/.gitignore",
    "chars": 33,
    "preview": ".gradle/\n.idea/\nout/\nbuild/\n*.iml"
  },
  {
    "path": "dont-use-in-memory-databases-tests/db-container-managed-by-the-test/build.gradle",
    "chars": 450,
    "preview": "plugins {\n    id 'org.springframework.boot' version '1.4.2.RELEASE'\n}\n\napply plugin: 'java'\n\ngroup 'de.philipphauer.blog"
  },
  {
    "path": "dont-use-in-memory-databases-tests/db-container-managed-by-the-test/docker-compose.yml",
    "chars": 169,
    "preview": "version: '2'\nservices:\n  mysql:\n    image: mysql:5.5.53\n    ports:\n      - \"3306:3306\"\n    environment:\n      MYSQL_ROOT"
  },
  {
    "path": "dont-use-in-memory-databases-tests/db-container-managed-by-the-test/gradle/wrapper/gradle-wrapper.properties",
    "chars": 231,
    "preview": "#Fri Aug 18 18:26:51 CEST 2017\ndistributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\nzipStoreBase=GRADLE_USER"
  },
  {
    "path": "dont-use-in-memory-databases-tests/db-container-managed-by-the-test/gradlew",
    "chars": 5296,
    "preview": "#!/usr/bin/env sh\n\n##############################################################################\n##\n##  Gradle start up"
  },
  {
    "path": "dont-use-in-memory-databases-tests/db-container-managed-by-the-test/gradlew.bat",
    "chars": 2176,
    "preview": "@if \"%DEBUG%\" == \"\" @echo off\n@rem ##########################################################################\n@rem\n@rem "
  },
  {
    "path": "dont-use-in-memory-databases-tests/db-container-managed-by-the-test/settings.gradle",
    "chars": 53,
    "preview": "rootProject.name = 'db-container-managed-by-gradle'\n\n"
  },
  {
    "path": "dont-use-in-memory-databases-tests/db-container-managed-by-the-test/src/test/java/de/philipphauer/blog/MyTest.java",
    "chars": 1799,
    "preview": "package de.philipphauer.blog;\n\nimport org.junit.AfterClass;\nimport org.junit.BeforeClass;\nimport org.junit.Test;\nimport "
  },
  {
    "path": "framework-beats-generator/.gitignore",
    "chars": 347,
    "preview": "db\n\n# Created by .ignore support plugin (hsz.mobi)\n### Maven template\ntarget/\npom.xml.tag\npom.xml.releaseBackup\npom.xml."
  },
  {
    "path": "framework-beats-generator/pom.xml",
    "chars": 2074,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www"
  },
  {
    "path": "framework-beats-generator/src/main/java/de/philipphauer/h2/H2WebConsole.java",
    "chars": 535,
    "preview": "package de.philipphauer.h2;\n\nimport org.h2.tools.Server;\n\nimport java.sql.SQLException;\n\npublic class H2WebConsole {\n\n  "
  },
  {
    "path": "framework-beats-generator/src/main/java/de/philipphauer/jpa/Article.java",
    "chars": 446,
    "preview": "package de.philipphauer.jpa;\n\nimport javax.persistence.Entity;\nimport javax.persistence.GeneratedValue;\nimport javax.per"
  },
  {
    "path": "framework-beats-generator/src/main/java/de/philipphauer/jpa/ArticleDAO.java",
    "chars": 945,
    "preview": "package de.philipphauer.jpa;\n\nimport javax.persistence.EntityManager;\nimport javax.persistence.EntityManagerFactory;\nimp"
  },
  {
    "path": "framework-beats-generator/src/main/java/de/philipphauer/mongojack/Product.java",
    "chars": 452,
    "preview": "package de.philipphauer.mongojack;\n\nimport org.mongojack.ObjectId;\n\npublic class Product {\n    @ObjectId\n    private Str"
  },
  {
    "path": "framework-beats-generator/src/main/java/de/philipphauer/mongojack/ProductDAO.java",
    "chars": 760,
    "preview": "package de.philipphauer.mongojack;\n\nimport com.mongodb.DB;\nimport com.mongodb.DBCollection;\nimport com.mongodb.MongoClie"
  },
  {
    "path": "framework-beats-generator/src/main/resources/META-INF/persistence.xml",
    "chars": 1058,
    "preview": "<persistence xmlns=\"http://java.sun.com/xml/ns/persistence\"\n             xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-ins"
  },
  {
    "path": "framework-beats-generator/src/test/java/de/philipphauer/jpa/ArticleDAOTest.java",
    "chars": 566,
    "preview": "package de.philipphauer.jpa;\n\nimport de.philipphauer.h2.H2WebConsole;\nimport org.junit.Test;\n\npublic class ArticleDAOTes"
  },
  {
    "path": "framework-beats-generator/src/test/java/de/philipphauer/jpa/H2Test.java",
    "chars": 405,
    "preview": "package de.philipphauer.jpa;\n\nimport org.junit.Test;\n\nimport java.sql.Connection;\nimport java.sql.DriverManager;\nimport "
  },
  {
    "path": "framework-beats-generator/src/test/java/de/philipphauer/mongojack/ProductDAOTest.java",
    "chars": 241,
    "preview": "package de.philipphauer.mongojack;\n\nimport org.junit.Test;\n\npublic class ProductDAOTest {\n\n    @Test\n    public void sav"
  },
  {
    "path": "framework-beats-generator/startMongoDBLocally.bat",
    "chars": 166,
    "preview": "rem local mongodb installation needed\n\necho \"Creating dbpath\"\nmkdir \\data\\db\\\n\necho \"Starting MongoDB...\"\nstart mongod \n"
  },
  {
    "path": "kotlin-examples/.gitignore",
    "chars": 20,
    "preview": ".idea/\ntarget/\n*.iml"
  },
  {
    "path": "kotlin-examples/pom.xml",
    "chars": 3769,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www"
  },
  {
    "path": "kotlin-examples/src/main/java/javaVariant/1DefineAndMapBeans.java",
    "chars": 5563,
    "preview": "package javaVariant;\n\nimport java.time.Instant;\nimport java.util.List;\nimport java.util.stream.Collectors;\n\n//BlogEntity"
  },
  {
    "path": "kotlin-examples/src/main/java/javaVariant/2ConditionsAndTypeSwitch.java",
    "chars": 1273,
    "preview": "package javaVariant;\n\nimport java.sql.SQLException;\nimport java.util.Locale;\n\nclass Conditions {\n    public Locale getDe"
  },
  {
    "path": "kotlin-examples/src/main/java/kotlinVariant/1DefineAndMapBeans.kt",
    "chars": 3002,
    "preview": "package kotlinVariant\n\nimport java.time.Instant\n\n//Data classes: Each entity definition in a single line! We get immutab"
  },
  {
    "path": "kotlin-examples/src/main/java/kotlinVariant/2ConditionsAndTypeSwitch.kt",
    "chars": 1227,
    "preview": "package kotlinVariant\n\nimport java.sql.SQLException\nimport java.util.Locale\n\n//\"when\" is extremely powerful construct is"
  },
  {
    "path": "kotlin-idiomatic/.gitignore",
    "chars": 20,
    "preview": ".idea/\ntarget/\n*.iml"
  },
  {
    "path": "kotlin-idiomatic/pom.xml",
    "chars": 4571,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www"
  },
  {
    "path": "kotlin-idiomatic/src/main/kotlin/idiomaticKotlin/Apply.kt",
    "chars": 647,
    "preview": "package idiomaticKotlin\n\nimport org.apache.commons.dbcp2.BasicDataSource\n\n\nfun blub(){\n    // Don't\n    val dataSource ="
  },
  {
    "path": "kotlin-idiomatic/src/main/kotlin/idiomaticKotlin/DefaultArgs.kt",
    "chars": 424,
    "preview": "package idiomaticKotlin\n\n// don't overload methods and constructors to realize default arguments (\"chaining\")\nfun find(n"
  },
  {
    "path": "kotlin-idiomatic/src/main/kotlin/idiomaticKotlin/Destruction.kt",
    "chars": 537,
    "preview": "package idiomaticKotlin\n\n//destruction useful for\n\n//a) returning multiple values from a function. define an own data cl"
  },
  {
    "path": "kotlin-idiomatic/src/main/kotlin/idiomaticKotlin/FunctionalProgramming.kt",
    "chars": 2150,
    "preview": "package idiomaticKotlin\n\nimport com.jayway.jsonpath.JsonPath\nimport java.util.Locale\n\n// # Take advantages of functional"
  },
  {
    "path": "kotlin-idiomatic/src/main/kotlin/idiomaticKotlin/InitBlock.kt",
    "chars": 1411,
    "preview": "package idiomaticKotlin\n\nimport org.apache.http.client.HttpClient\nimport org.apache.http.impl.client.HttpClientBuilder\ni"
  },
  {
    "path": "kotlin-idiomatic/src/main/kotlin/idiomaticKotlin/Mapping.kt",
    "chars": 1155,
    "preview": "package idiomaticKotlin\n\nimport java.time.Instant\n\n\ndata class SnippetDTO(\n        val code: String,\n        val author:"
  },
  {
    "path": "kotlin-idiomatic/src/main/kotlin/idiomaticKotlin/NamedArgs.kt",
    "chars": 966,
    "preview": "package idiomaticKotlin\n\nclass SearchConfig {\n    fun setRoot(s: String): SearchConfig { return this }\n    fun setTerm(s"
  },
  {
    "path": "kotlin-idiomatic/src/main/kotlin/idiomaticKotlin/Nullability.kt",
    "chars": 1758,
    "preview": "package idiomaticKotlin\n\ndata class Order(val customer: Customer?)\ndata class Customer(val address: Address?)\ndata class"
  },
  {
    "path": "kotlin-idiomatic/src/main/kotlin/idiomaticKotlin/ObjectForStatelessFWImpls.kt",
    "chars": 1206,
    "preview": "package idiomaticKotlin\n\nimport com.vaadin.data.Converter\nimport com.vaadin.data.Result\nimport com.vaadin.data.ValueCont"
  },
  {
    "path": "kotlin-idiomatic/src/main/kotlin/idiomaticKotlin/Structs.kt",
    "chars": 550,
    "preview": "package idiomaticKotlin\n\n// due to `to` infix function to create a Pair and static methods to create lists and maps, def"
  },
  {
    "path": "kotlin-idiomatic/src/main/kotlin/idiomaticKotlin/TopLevelExtensionFunctions.kt",
    "chars": 590,
    "preview": "package idiomaticKotlin\n\n// In Java, you often create static util methods in util classes.\nobject StringUtil {\n    fun c"
  },
  {
    "path": "kotlin-idiomatic/src/main/kotlin/idiomaticKotlin/ValueObjects.kt",
    "chars": 204,
    "preview": "package idiomaticKotlin\n\n//without value object:\nfun send(target: String){}\n\n//expressive, readable, safe\nfun send(targe"
  },
  {
    "path": "kotlin-spring-boot-vaadin-scaffolding/.gitignore",
    "chars": 26,
    "preview": "target/\n.idea\n*.iml\ndev/\n\n"
  },
  {
    "path": "kotlin-spring-boot-vaadin-scaffolding/README.md",
    "chars": 588,
    "preview": "# Scaffolding for Kotlin, Spring Boot, Vaadin, Spring Data MongoDB\n\n## Development\n### Database\nStart/Stop MongoDB and M"
  },
  {
    "path": "kotlin-spring-boot-vaadin-scaffolding/TODO.md",
    "chars": 17,
    "preview": "- tests\n- screeny"
  },
  {
    "path": "kotlin-spring-boot-vaadin-scaffolding/docker-compose.yml",
    "chars": 185,
    "preview": "version: '2'\nservices:\n  mongo:\n    image: mongo:3.2.10\n    volumes:\n      - ./dev/mongodbdata:/data/db\n    ports:\n     "
  },
  {
    "path": "kotlin-spring-boot-vaadin-scaffolding/myapp.yaml",
    "chars": 450,
    "preview": "server:\n  port: 8080\nspring:\n  data:\n    mongodb:\n      host: localhost\n      port: 27017\n      database: test\n  datasou"
  },
  {
    "path": "kotlin-spring-boot-vaadin-scaffolding/pom.xml",
    "chars": 5705,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2"
  },
  {
    "path": "kotlin-spring-boot-vaadin-scaffolding/src/main/kotlin/de/philipphauer/blog/misc/PuttingTogether.kt",
    "chars": 245,
    "preview": "package de.philipphauer.blog.misc\n\nimport java.time.Instant\n\ndata class BlogEntity (\n        val author: AuthorEntity,\n "
  },
  {
    "path": "kotlin-spring-boot-vaadin-scaffolding/src/main/kotlin/de/philipphauer/blog/misc/ValueObjects.kt",
    "chars": 199,
    "preview": "package de.philipphauer.blog.misc\n\nfun process1(emails: List<String>){}\n//vs\n\ndata class EmailAddress(val address: Strin"
  },
  {
    "path": "kotlin-spring-boot-vaadin-scaffolding/src/main/kotlin/de/philipphauer/blog/misc/constructorinjection/CRMClient.java",
    "chars": 84,
    "preview": "package de.philipphauer.blog.misc.constructorinjection;\n\npublic class CRMClient {\n}\n"
  },
  {
    "path": "kotlin-spring-boot-vaadin-scaffolding/src/main/kotlin/de/philipphauer/blog/misc/constructorinjection/ConstructorInjection.kt",
    "chars": 205,
    "preview": "package de.philipphauer.blog.misc.constructorinjection\n\nclass CustomerResourceKotlin(private val repo: CustomerRepositor"
  },
  {
    "path": "kotlin-spring-boot-vaadin-scaffolding/src/main/kotlin/de/philipphauer/blog/misc/constructorinjection/CustomerRepository.java",
    "chars": 93,
    "preview": "package de.philipphauer.blog.misc.constructorinjection;\n\npublic class CustomerRepository {\n}\n"
  },
  {
    "path": "kotlin-spring-boot-vaadin-scaffolding/src/main/kotlin/de/philipphauer/blog/misc/constructorinjection/CustomerResource.java",
    "chars": 294,
    "preview": "package de.philipphauer.blog.misc.constructorinjection;\n\npublic class CustomerResource {\n\n    private CustomerRepository"
  },
  {
    "path": "kotlin-spring-boot-vaadin-scaffolding/src/main/kotlin/de/philipphauer/blog/misc/vaadin/ActionListenerLambdaExample.kt",
    "chars": 442,
    "preview": "package de.philipphauer.blog.misc.vaadin\n\nimport com.vaadin.ui.Button\nimport com.vaadin.ui.Notification\n\n\nclass ActionLi"
  },
  {
    "path": "kotlin-spring-boot-vaadin-scaffolding/src/main/kotlin/de/philipphauer/blog/misc/vaadin/ActionListenerLambdaExampleJava.java",
    "chars": 461,
    "preview": "package de.philipphauer.blog.misc.vaadin;\n\nimport com.vaadin.ui.Button;\nimport com.vaadin.ui.Notification;\n\npublic class"
  },
  {
    "path": "kotlin-spring-boot-vaadin-scaffolding/src/main/kotlin/de/philipphauer/blog/scaffolding/DummyDataCreator.kt",
    "chars": 1205,
    "preview": "package de.philipphauer.blog.scaffolding\n\nimport de.philipphauer.blog.scaffolding.db.AuthorEntity\nimport de.philipphauer"
  },
  {
    "path": "kotlin-spring-boot-vaadin-scaffolding/src/main/kotlin/de/philipphauer/blog/scaffolding/MyApplication.kt",
    "chars": 478,
    "preview": "package de.philipphauer.blog.scaffolding\n\nimport org.springframework.boot.SpringApplication\nimport org.springframework.b"
  },
  {
    "path": "kotlin-spring-boot-vaadin-scaffolding/src/main/kotlin/de/philipphauer/blog/scaffolding/SpringConfiguration.kt",
    "chars": 547,
    "preview": "package de.philipphauer.blog.scaffolding\n\nimport org.slf4j.Logger\nimport org.slf4j.LoggerFactory\nimport org.springframew"
  },
  {
    "path": "kotlin-spring-boot-vaadin-scaffolding/src/main/kotlin/de/philipphauer/blog/scaffolding/YamlConfigProps.kt",
    "chars": 680,
    "preview": "package de.philipphauer.blog.scaffolding\n\nimport org.springframework.boot.context.properties.ConfigurationProperties\nimp"
  },
  {
    "path": "kotlin-spring-boot-vaadin-scaffolding/src/main/kotlin/de/philipphauer/blog/scaffolding/db/Entities.kt",
    "chars": 737,
    "preview": "package de.philipphauer.blog.scaffolding.db\n\nimport org.bson.types.ObjectId\nimport org.springframework.data.annotation.I"
  },
  {
    "path": "kotlin-spring-boot-vaadin-scaffolding/src/main/kotlin/de/philipphauer/blog/scaffolding/db/SnippetRepository.kt",
    "chars": 183,
    "preview": "package de.philipphauer.blog.scaffolding.db\n\nimport org.springframework.data.mongodb.repository.MongoRepository\n\ninterfa"
  },
  {
    "path": "kotlin-spring-boot-vaadin-scaffolding/src/main/kotlin/de/philipphauer/blog/scaffolding/rest/AdminResource.kt",
    "chars": 3316,
    "preview": "package de.philipphauer.blog.scaffolding.rest\n\nimport com.google.common.io.Resources\nimport org.springframework.data.mon"
  },
  {
    "path": "kotlin-spring-boot-vaadin-scaffolding/src/main/kotlin/de/philipphauer/blog/scaffolding/ui/Beans.kt",
    "chars": 653,
    "preview": "package de.philipphauer.blog.scaffolding.ui\n\nimport de.philipphauer.blog.scaffolding.db.SnippetState\nimport java.time.In"
  },
  {
    "path": "kotlin-spring-boot-vaadin-scaffolding/src/main/kotlin/de/philipphauer/blog/scaffolding/ui/DetailsWindow.kt",
    "chars": 1421,
    "preview": "package de.philipphauer.blog.scaffolding.ui\n\nimport com.vaadin.server.FontAwesome\nimport com.vaadin.server.Sizeable\nimpo"
  },
  {
    "path": "kotlin-spring-boot-vaadin-scaffolding/src/main/kotlin/de/philipphauer/blog/scaffolding/ui/EntityToBeanMapper.kt",
    "chars": 398,
    "preview": "package de.philipphauer.blog.scaffolding.ui\n\nimport de.philipphauer.blog.scaffolding.db.SnippetEntity\n\nfun mapToBeans(en"
  },
  {
    "path": "kotlin-spring-boot-vaadin-scaffolding/src/main/kotlin/de/philipphauer/blog/scaffolding/ui/MainViewDisplay.kt",
    "chars": 484,
    "preview": "package de.philipphauer.blog.scaffolding.ui\n\nimport com.vaadin.navigator.View\nimport com.vaadin.navigator.ViewDisplay\nim"
  },
  {
    "path": "kotlin-spring-boot-vaadin-scaffolding/src/main/kotlin/de/philipphauer/blog/scaffolding/ui/MyAppUI.kt",
    "chars": 1325,
    "preview": "package de.philipphauer.blog.scaffolding.ui\n\nimport com.vaadin.annotations.Theme\nimport com.vaadin.server.FontAwesome\nim"
  },
  {
    "path": "kotlin-spring-boot-vaadin-scaffolding/src/main/kotlin/de/philipphauer/blog/scaffolding/ui/NavigationPresenter.kt",
    "chars": 2096,
    "preview": "package de.philipphauer.blog.scaffolding.ui\n\nimport com.vaadin.navigator.View\nimport com.vaadin.server.FontAwesome\nimpor"
  },
  {
    "path": "kotlin-spring-boot-vaadin-scaffolding/src/main/kotlin/de/philipphauer/blog/scaffolding/ui/UiMisc.kt",
    "chars": 465,
    "preview": "package de.philipphauer.blog.scaffolding.ui\n\nimport com.vaadin.server.FontAwesome\nimport de.philipphauer.blog.scaffoldin"
  },
  {
    "path": "kotlin-spring-boot-vaadin-scaffolding/src/main/kotlin/de/philipphauer/blog/scaffolding/ui/views/CreateSnippetView.kt",
    "chars": 2492,
    "preview": "package de.philipphauer.blog.scaffolding.ui.views\n\nimport com.vaadin.data.fieldgroup.BeanFieldGroup\nimport com.vaadin.da"
  },
  {
    "path": "kotlin-spring-boot-vaadin-scaffolding/src/main/kotlin/de/philipphauer/blog/scaffolding/ui/views/ErrorView.kt",
    "chars": 644,
    "preview": "package de.philipphauer.blog.scaffolding.ui.views\n\nimport com.vaadin.navigator.View\nimport com.vaadin.navigator.ViewChan"
  },
  {
    "path": "kotlin-spring-boot-vaadin-scaffolding/src/main/kotlin/de/philipphauer/blog/scaffolding/ui/views/OverviewView.kt",
    "chars": 4149,
    "preview": "package de.philipphauer.blog.scaffolding.ui.views\n\nimport com.vaadin.data.util.BeanItem\nimport com.vaadin.data.util.Bean"
  },
  {
    "path": "kotlin-spring-boot-vaadin-scaffolding/src/main/resources/VAADIN/themes/mytheme/mytheme.scss",
    "chars": 113,
    "preview": "@import \"../valo/valo.scss\";\n\n@mixin mytheme {\n  @include valo;\n\n  .monospace {\n    font-family: monospace;\n  }\n}"
  },
  {
    "path": "kotlin-spring-boot-vaadin-scaffolding/src/main/resources/VAADIN/themes/mytheme/styles.scss",
    "chars": 52,
    "preview": "@import \"mytheme\";\n\n.mytheme {\n  @include mytheme;\n}"
  },
  {
    "path": "kotlin-spring-boot-vaadin-scaffolding/src/main/resources/application.properties",
    "chars": 1489,
    "preview": "# see http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html\n\n# productionMode"
  },
  {
    "path": "kotlin-spring-boot-vaadin-scaffolding/src/main/resources/banner.txt",
    "chars": 423,
    "preview": "  _  __     _   _ _                        _        \n | |/ /    | | | (_)                      | |       \n | ' / ___ | |"
  },
  {
    "path": "kotlin-spring-boot-vaadin-scaffolding/src/test/kotlin/de/philipphauer/blog/scaffolding/DummyDataCreatorTest.kt",
    "chars": 68,
    "preview": "package de.philipphauer.blog.scaffolding\n\nclass DummyDataCreatorTest"
  },
  {
    "path": "modern-best-practices-testing-java/.gitignore",
    "chars": 277,
    "preview": "HELP.md\n/target/\n!.mvn/wrapper/maven-wrapper.jar\n\n### STS ###\n.apt_generated\n.classpath\n.factorypath\n.project\n.settings\n"
  },
  {
    "path": "modern-best-practices-testing-java/docker-compose.yml",
    "chars": 270,
    "preview": "version: '3.1'\nservices:\n  db:\n    image: \"postgres:11.2-alpine\"\n    environment:\n      POSTGRES_PASSWORD: password\n    "
  },
  {
    "path": "modern-best-practices-testing-java/pom.xml",
    "chars": 4489,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2"
  },
  {
    "path": "modern-best-practices-testing-java/src/main/java/com/phauer/modernunittesting/FuturePlayground.java",
    "chars": 783,
    "preview": "package com.phauer.modernunittesting;\n\nimport org.springframework.scheduling.annotation.Scheduled;\n\nimport java.util.Loc"
  },
  {
    "path": "modern-best-practices-testing-java/src/main/java/com/phauer/modernunittesting/MainLayout.java",
    "chars": 378,
    "preview": "package com.phauer.modernunittesting;\n\nimport com.vaadin.flow.component.html.Div;\nimport com.vaadin.flow.component.page."
  },
  {
    "path": "modern-best-practices-testing-java/src/main/java/com/phauer/modernunittesting/ModernUnitTestingApplication.java",
    "chars": 355,
    "preview": "package com.phauer.modernunittesting;\n\nimport org.springframework.boot.SpringApplication;\nimport org.springframework.boo"
  },
  {
    "path": "modern-best-practices-testing-java/src/main/java/com/phauer/modernunittesting/PriceCalculator.java",
    "chars": 133,
    "preview": "package com.phauer.modernunittesting;\n\nimport org.springframework.stereotype.Component;\n\n@Component\npublic class PriceCa"
  },
  {
    "path": "modern-best-practices-testing-java/src/main/java/com/phauer/modernunittesting/ProductController.java",
    "chars": 1004,
    "preview": "package com.phauer.modernunittesting;\n\nimport org.springframework.web.bind.annotation.GetMapping;\nimport org.springframe"
  },
  {
    "path": "modern-best-practices-testing-java/src/main/java/com/phauer/modernunittesting/ProductDAO.java",
    "chars": 744,
    "preview": "package com.phauer.modernunittesting;\n\nimport org.springframework.jdbc.core.JdbcTemplate;\nimport org.springframework.ste"
  },
  {
    "path": "modern-best-practices-testing-java/src/main/java/com/phauer/modernunittesting/ProductDTO.java",
    "chars": 1403,
    "preview": "package com.phauer.modernunittesting;\n\nimport java.util.Objects;\nimport java.util.StringJoiner;\n\npublic class ProductDTO"
  },
  {
    "path": "modern-best-practices-testing-java/src/main/java/com/phauer/modernunittesting/ProductEntity.java",
    "chars": 1098,
    "preview": "package com.phauer.modernunittesting;\n\npublic class ProductEntity {\n    private String id;\n    private String name;\n    "
  },
  {
    "path": "modern-best-practices-testing-java/src/main/java/com/phauer/modernunittesting/ProductModel.java",
    "chars": 1122,
    "preview": "package com.phauer.modernunittesting;\n\nimport java.util.Objects;\nimport java.util.StringJoiner;\n\npublic class ProductMod"
  },
  {
    "path": "modern-best-practices-testing-java/src/main/java/com/phauer/modernunittesting/ProductView.java",
    "chars": 1413,
    "preview": "package com.phauer.modernunittesting;\n\nimport com.vaadin.flow.component.ClickEvent;\nimport com.vaadin.flow.component.but"
  },
  {
    "path": "modern-best-practices-testing-java/src/main/java/com/phauer/modernunittesting/SchemaCreator.java",
    "chars": 1014,
    "preview": "package com.phauer.modernunittesting;\n\nimport org.springframework.boot.ApplicationArguments;\nimport org.springframework."
  },
  {
    "path": "modern-best-practices-testing-java/src/main/java/com/phauer/modernunittesting/TaxServiceClient.java",
    "chars": 223,
    "preview": "package com.phauer.modernunittesting;\n\nimport org.springframework.stereotype.Component;\n\n@Component\npublic class TaxServ"
  },
  {
    "path": "modern-best-practices-testing-java/src/main/java/com/phauer/modernunittesting/TaxServiceResponseDTO.java",
    "chars": 577,
    "preview": "package com.phauer.modernunittesting;\n\nimport java.util.Locale;\n\npublic class TaxServiceResponseDTO {\n\n    private Strin"
  },
  {
    "path": "modern-best-practices-testing-java/src/main/resources/application.properties",
    "chars": 183,
    "preview": "spring.datasource.driverClassName=org.postgresql.Driver\nspring.datasource.url=jdbc:postgresql://localhost:5432/\nspring.d"
  },
  {
    "path": "modern-best-practices-testing-java/src/test/java/com/phauer/modernunittesting/AssertJTest.java",
    "chars": 2793,
    "preview": "package com.phauer.modernunittesting;\n\n\nimport org.junit.jupiter.api.Test;\n\nimport java.time.Instant;\nimport java.util.A"
  },
  {
    "path": "modern-best-practices-testing-java/src/test/java/com/phauer/modernunittesting/AwaitilityTest.java",
    "chars": 844,
    "preview": "package com.phauer.modernunittesting;\n\nimport org.awaitility.core.ConditionFactory;\nimport org.junit.jupiter.api.Test;\n\n"
  },
  {
    "path": "modern-best-practices-testing-java/src/test/java/com/phauer/modernunittesting/DesignControllerTest.java",
    "chars": 656,
    "preview": "package com.phauer.modernunittesting;\n\nimport org.junit.jupiter.api.Nested;\nimport org.junit.jupiter.api.Test;\n\npublic c"
  },
  {
    "path": "modern-best-practices-testing-java/src/test/java/com/phauer/modernunittesting/DisplayNameTest.java",
    "chars": 692,
    "preview": "package com.phauer.modernunittesting;\n\nimport org.junit.jupiter.api.DisplayName;\nimport org.junit.jupiter.api.Test;\n\npub"
  },
  {
    "path": "modern-best-practices-testing-java/src/test/java/com/phauer/modernunittesting/HelperFunctions.java",
    "chars": 6405,
    "preview": "package com.phauer.modernunittesting;\n\nimport com.fasterxml.jackson.core.JsonProcessingException;\nimport com.fasterxml.j"
  },
  {
    "path": "modern-best-practices-testing-java/src/test/java/com/phauer/modernunittesting/ParameterTest.java",
    "chars": 676,
    "preview": "package com.phauer.modernunittesting;\n\nimport org.junit.jupiter.params.ParameterizedTest;\nimport org.junit.jupiter.param"
  },
  {
    "path": "modern-best-practices-testing-java/src/test/java/com/phauer/modernunittesting/Product.java",
    "chars": 1939,
    "preview": "package com.phauer.modernunittesting;\n\nimport java.time.Instant;\nimport java.util.Objects;\nimport java.util.StringJoiner"
  },
  {
    "path": "modern-best-practices-testing-java/src/test/java/com/phauer/modernunittesting/ProductControllerITest.java",
    "chars": 5299,
    "preview": "package com.phauer.modernunittesting;\n\nimport com.fasterxml.jackson.core.JsonProcessingException;\nimport com.fasterxml.j"
  },
  {
    "path": "modern-best-practices-testing-java/src/test/java/com/phauer/modernunittesting/ProductControllerITest2.java",
    "chars": 263,
    "preview": "package com.phauer.modernunittesting;\n\nimport org.junit.jupiter.api.Test;\nimport org.springframework.boot.test.autoconfi"
  },
  {
    "path": "modern-best-practices-testing-java/src/test/java/com/phauer/modernunittesting/ProductViewITest.java",
    "chars": 2464,
    "preview": "package com.phauer.modernunittesting;\n\nimport com.github.mvysny.kaributesting.v10.GridKt;\nimport com.github.mvysny.karib"
  },
  {
    "path": "modern-best-practices-testing-java/src/test/java/com/phauer/modernunittesting/RandomizedValues.java",
    "chars": 940,
    "preview": "package com.phauer.modernunittesting;\n\nimport org.bson.types.ObjectId;\nimport org.junit.jupiter.api.Test;\n\nimport java.t"
  },
  {
    "path": "modern-integration-testing/.gitignore",
    "chars": 277,
    "preview": "HELP.md\n/target/\n!.mvn/wrapper/maven-wrapper.jar\n\n### STS ###\n.apt_generated\n.classpath\n.factorypath\n.project\n.settings\n"
  },
  {
    "path": "modern-integration-testing/docker-compose.yml",
    "chars": 270,
    "preview": "version: '3.1'\nservices:\n  db:\n    image: \"postgres:11.2-alpine\"\n    environment:\n      POSTGRES_PASSWORD: password\n    "
  },
  {
    "path": "modern-integration-testing/pom.xml",
    "chars": 4106,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2"
  },
  {
    "path": "modern-integration-testing/src/main/java/com/phauer/modernunittesting/MainLayout.java",
    "chars": 378,
    "preview": "package com.phauer.modernunittesting;\n\nimport com.vaadin.flow.component.html.Div;\nimport com.vaadin.flow.component.page."
  },
  {
    "path": "modern-integration-testing/src/main/java/com/phauer/modernunittesting/ModernUnitTestingApplication.java",
    "chars": 355,
    "preview": "package com.phauer.modernunittesting;\n\nimport org.springframework.boot.SpringApplication;\nimport org.springframework.boo"
  },
  {
    "path": "modern-integration-testing/src/main/java/com/phauer/modernunittesting/PriceCalculator.java",
    "chars": 133,
    "preview": "package com.phauer.modernunittesting;\n\nimport org.springframework.stereotype.Component;\n\n@Component\npublic class PriceCa"
  },
  {
    "path": "modern-integration-testing/src/main/java/com/phauer/modernunittesting/ProductController.java",
    "chars": 1004,
    "preview": "package com.phauer.modernunittesting;\n\nimport org.springframework.web.bind.annotation.GetMapping;\nimport org.springframe"
  },
  {
    "path": "modern-integration-testing/src/main/java/com/phauer/modernunittesting/ProductDAO.java",
    "chars": 744,
    "preview": "package com.phauer.modernunittesting;\n\nimport org.springframework.jdbc.core.JdbcTemplate;\nimport org.springframework.ste"
  },
  {
    "path": "modern-integration-testing/src/main/java/com/phauer/modernunittesting/ProductDTO.java",
    "chars": 1403,
    "preview": "package com.phauer.modernunittesting;\n\nimport java.util.Objects;\nimport java.util.StringJoiner;\n\npublic class ProductDTO"
  },
  {
    "path": "modern-integration-testing/src/main/java/com/phauer/modernunittesting/ProductEntity.java",
    "chars": 1128,
    "preview": "package com.phauer.modernunittesting;\n\nimport java.util.Objects;\nimport java.util.StringJoiner;\n\npublic class ProductEnt"
  },
  {
    "path": "modern-integration-testing/src/main/java/com/phauer/modernunittesting/ProductModel.java",
    "chars": 1122,
    "preview": "package com.phauer.modernunittesting;\n\nimport java.util.Objects;\nimport java.util.StringJoiner;\n\npublic class ProductMod"
  },
  {
    "path": "modern-integration-testing/src/main/java/com/phauer/modernunittesting/ProductView.java",
    "chars": 1413,
    "preview": "package com.phauer.modernunittesting;\n\nimport com.vaadin.flow.component.ClickEvent;\nimport com.vaadin.flow.component.but"
  },
  {
    "path": "modern-integration-testing/src/main/java/com/phauer/modernunittesting/SchemaCreator.java",
    "chars": 1014,
    "preview": "package com.phauer.modernunittesting;\n\nimport org.springframework.boot.ApplicationArguments;\nimport org.springframework."
  },
  {
    "path": "modern-integration-testing/src/main/java/com/phauer/modernunittesting/TaxServiceClient.java",
    "chars": 222,
    "preview": "package com.phauer.modernunittesting;\n\nimport org.springframework.stereotype.Component;\n\n@Component\npublic class TaxServ"
  },
  {
    "path": "modern-integration-testing/src/main/java/com/phauer/modernunittesting/TaxServiceResponseDTO.java",
    "chars": 577,
    "preview": "package com.phauer.modernunittesting;\n\nimport java.util.Locale;\n\npublic class TaxServiceResponseDTO {\n\n    private Strin"
  },
  {
    "path": "modern-integration-testing/src/main/resources/application.properties",
    "chars": 183,
    "preview": "spring.datasource.driverClassName=org.postgresql.Driver\nspring.datasource.url=jdbc:postgresql://localhost:5432/\nspring.d"
  }
]

// ... and 163 more files (download for full content)

About this extraction

This page contains the full source code of the phauer/blog-related GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 363 files (505.3 KB), approximately 140.9k tokens, and a symbol index with 589 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!