├── .github └── workflows │ └── update_gh_pages.yml ├── .gitignore ├── README.adoc ├── build.gradle ├── etc └── ide │ ├── README.adoc │ ├── eclipse-formatting.xml │ └── springdata.importorder ├── examples ├── bookmark-sync-plain-spring │ ├── .gitignore │ ├── .mvn │ │ └── wrapper │ │ │ ├── MavenWrapperDownloader.java │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── org │ │ │ └── neo4j │ │ │ └── examples │ │ │ └── jvm │ │ │ └── spring │ │ │ └── plain │ │ │ └── imperative │ │ │ ├── Application.java │ │ │ ├── Neo4jBookmarkManager.java │ │ │ ├── Neo4jConfig.java │ │ │ └── movies │ │ │ ├── Actor.java │ │ │ ├── Movie.java │ │ │ ├── MovieRepository.java │ │ │ ├── MoviesController.java │ │ │ ├── PeopleController.java │ │ │ ├── PeopleRepository.java │ │ │ ├── Person.java │ │ │ └── PersonDetails.java │ │ └── resources │ │ └── application.properties ├── bookmark-sync-sdn5 │ ├── .gitignore │ ├── .mvn │ │ └── wrapper │ │ │ ├── MavenWrapperDownloader.java │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── example │ │ │ └── bookmarksyncsdn5 │ │ │ ├── Application.java │ │ │ ├── Neo4jConfig.java │ │ │ └── movies │ │ │ ├── Actor.java │ │ │ ├── Movie.java │ │ │ ├── MovieRepository.java │ │ │ ├── MoviesController.java │ │ │ ├── PeopleController.java │ │ │ ├── PeopleRepository.java │ │ │ ├── Person.java │ │ │ └── PersonDetails.java │ │ └── resources │ │ └── application.properties ├── bookmark-sync-sdn6 │ ├── .gitignore │ ├── .mvn │ │ └── wrapper │ │ │ ├── MavenWrapperDownloader.java │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── example │ │ │ └── bookmarksyncsdn6 │ │ │ ├── Application.java │ │ │ ├── Neo4jConfig.java │ │ │ └── movies │ │ │ ├── Actor.java │ │ │ ├── Movie.java │ │ │ ├── MovieRepository.java │ │ │ ├── MoviesController.java │ │ │ ├── PeopleController.java │ │ │ ├── PeopleRepository.java │ │ │ ├── Person.java │ │ │ └── PersonDetails.java │ │ └── resources │ │ └── application.properties ├── choosing-identifiers │ ├── .gitignore │ ├── .mvn │ │ └── wrapper │ │ │ ├── MavenWrapperDownloader.java │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── neo4j │ │ │ │ └── tips │ │ │ │ └── ogm │ │ │ │ └── choosing_identifier │ │ │ │ ├── BadPerson.java │ │ │ │ ├── BadPersonRepository.java │ │ │ │ ├── DemoApplication.java │ │ │ │ ├── PersonWithExternalSurrogateKey.java │ │ │ │ ├── PersonWithExternalSurrogateKeyRepository.java │ │ │ │ ├── PersonWithInternalSurrogateKey.java │ │ │ │ ├── PersonWithInternalSurrogateKeyRepository.java │ │ │ │ ├── TaxPayer.java │ │ │ │ └── TaxPayerRepository.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── org │ │ └── neo4j │ │ └── tips │ │ └── ogm │ │ └── choosing_identifier │ │ ├── DemoApplicationTests.java │ │ └── RepositoriesTest.java ├── micronaut-embedded-with-user-functions │ ├── .mvn │ │ └── wrapper │ │ │ ├── MavenWrapperDownloader.java │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── Dockerfile │ ├── README.md │ ├── micronaut-cli.yml │ ├── mvnw │ ├── mvnw.bat │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── neo4j │ │ │ │ └── tips │ │ │ │ └── micronaut │ │ │ │ ├── Application.java │ │ │ │ ├── Neo4jController.java │ │ │ │ ├── Neo4jFactory.java │ │ │ │ └── SomeCustomFunction.java │ │ └── resources │ │ │ ├── application.yml │ │ │ └── logback.xml │ │ └── test │ │ └── java │ │ └── org │ │ └── neo4j │ │ └── tips │ │ └── micronaut │ │ └── Embedded_with_user_functionsTest.java ├── neo4j-and-helidon-se-reactive │ ├── .dockerignore │ ├── .vscode │ │ └── settings.json │ ├── Dockerfile │ ├── Dockerfile.jlink │ ├── Dockerfile.native │ ├── README.md │ ├── app.yaml │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── io │ │ │ │ └── helidon │ │ │ │ └── examples │ │ │ │ └── quickstart │ │ │ │ └── se │ │ │ │ ├── GreetService.java │ │ │ │ ├── Main.java │ │ │ │ ├── api │ │ │ │ ├── MovieService.java │ │ │ │ └── SseJsonObjectBodyStreamWriter.java │ │ │ │ ├── domain │ │ │ │ ├── Actor.java │ │ │ │ ├── Movie.java │ │ │ │ ├── MovieRepository.java │ │ │ │ └── Person.java │ │ │ │ └── package-info.java │ │ └── resources │ │ │ ├── META-INF │ │ │ └── native-image │ │ │ │ └── reflect-config.json │ │ │ ├── application.yaml │ │ │ └── logging.properties │ │ └── test │ │ └── java │ │ └── io │ │ └── helidon │ │ └── examples │ │ └── quickstart │ │ └── se │ │ └── MainTest.java ├── neo4j-and-helidon-se │ ├── .dockerignore │ ├── .vscode │ │ └── settings.json │ ├── Dockerfile │ ├── Dockerfile.jlink │ ├── Dockerfile.native │ ├── README.md │ ├── app.yaml │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── io │ │ │ │ └── helidon │ │ │ │ └── examples │ │ │ │ └── quickstart │ │ │ │ └── se │ │ │ │ ├── GreetService.java │ │ │ │ ├── Main.java │ │ │ │ ├── api │ │ │ │ └── MovieService.java │ │ │ │ ├── domain │ │ │ │ ├── Actor.java │ │ │ │ ├── Movie.java │ │ │ │ ├── MovieRepository.java │ │ │ │ └── Person.java │ │ │ │ └── package-info.java │ │ └── resources │ │ │ ├── META-INF │ │ │ └── native-image │ │ │ │ └── reflect-config.json │ │ │ ├── application.yaml │ │ │ └── logging.properties │ │ └── test │ │ └── java │ │ └── io │ │ └── helidon │ │ └── examples │ │ └── quickstart │ │ └── se │ │ └── MainTest.java ├── retries-through-space-and-time │ ├── README.adoc │ ├── client │ │ ├── .mvn │ │ │ └── wrapper │ │ │ │ ├── MavenWrapperDownloader.java │ │ │ │ ├── maven-wrapper.jar │ │ │ │ └── maven-wrapper.properties │ │ ├── mvnw │ │ ├── mvnw.cmd │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── org │ │ │ └── neo4j │ │ │ └── tips │ │ │ └── cluster │ │ │ └── client │ │ │ ├── Application.java │ │ │ ├── Movie.java │ │ │ └── Watcher.java │ ├── driver_with_tx_function │ │ ├── .mvn │ │ │ └── wrapper │ │ │ │ ├── MavenWrapperDownloader.java │ │ │ │ ├── maven-wrapper.jar │ │ │ │ └── maven-wrapper.properties │ │ ├── mvnw │ │ ├── mvnw.cmd │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ ├── java │ │ │ └── org │ │ │ │ └── neo4j │ │ │ │ └── tips │ │ │ │ └── cluster │ │ │ │ └── driver_with_tx_function │ │ │ │ ├── Application.java │ │ │ │ ├── api │ │ │ │ └── MovieController.java │ │ │ │ ├── config │ │ │ │ └── SecurityConfig.java │ │ │ │ ├── domain │ │ │ │ ├── Movie.java │ │ │ │ └── MovieService.java │ │ │ │ └── support │ │ │ │ └── InsertRandom.java │ │ │ └── resources │ │ │ ├── application.properties │ │ │ └── neo4j │ │ │ └── migrations │ │ │ ├── V0001__Create_movie_graph.cypher │ │ │ ├── V0002__Create_unique_constraint_on_movies.cypher │ │ │ └── V0003__Create_unique_constraint_on_person.cypher │ ├── sdn6 │ │ ├── .mvn │ │ │ └── wrapper │ │ │ │ ├── MavenWrapperDownloader.java │ │ │ │ ├── maven-wrapper.jar │ │ │ │ └── maven-wrapper.properties │ │ ├── mvnw │ │ ├── mvnw.cmd │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ ├── java │ │ │ └── org │ │ │ │ └── neo4j │ │ │ │ └── tips │ │ │ │ └── cluster │ │ │ │ └── sdn_ogm │ │ │ │ ├── Application.java │ │ │ │ ├── api │ │ │ │ └── MovieController.java │ │ │ │ ├── config │ │ │ │ └── SecurityConfig.java │ │ │ │ ├── domain │ │ │ │ ├── Movie.java │ │ │ │ ├── MovieService.java │ │ │ │ ├── MovieServiceBasedOnSDN.java │ │ │ │ ├── MovieServiceBasedOnTemplate.java │ │ │ │ ├── User.java │ │ │ │ └── WatchedMovie.java │ │ │ │ └── support │ │ │ │ ├── InsertRandom.java │ │ │ │ └── RetrySDN6ExceptionPredicate.java │ │ │ └── resources │ │ │ ├── application.properties │ │ │ └── neo4j │ │ │ └── migrations │ │ │ ├── V0001__Create_movie_graph.cypher │ │ │ ├── V0002__Create_unique_constraint_on_movies.cypher │ │ │ └── V0003__Create_unique_constraint_on_person.cypher │ └── sdn_ogm │ │ ├── .mvn │ │ └── wrapper │ │ │ ├── MavenWrapperDownloader.java │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ │ ├── mvnw │ │ ├── mvnw.cmd │ │ ├── pom.xml │ │ └── src │ │ └── main │ │ ├── java │ │ └── org │ │ │ └── neo4j │ │ │ └── tips │ │ │ └── cluster │ │ │ └── sdn_ogm │ │ │ ├── Application.java │ │ │ ├── api │ │ │ └── MovieController.java │ │ │ ├── config │ │ │ └── SecurityConfig.java │ │ │ ├── domain │ │ │ ├── Movie.java │ │ │ ├── MovieService.java │ │ │ ├── MovieServiceBasedOnPureOGM.java │ │ │ ├── MovieServiceBasedOnSDN.java │ │ │ ├── User.java │ │ │ └── WatchedMovie.java │ │ │ └── support │ │ │ ├── InsertRandom.java │ │ │ └── RetryOGMSDNExceptionPredicate.java │ │ └── resources │ │ ├── application.properties │ │ └── neo4j │ │ └── migrations │ │ ├── V0001__Create_movie_graph.cypher │ │ ├── V0002__Create_unique_constraint_on_movies.cypher │ │ └── V0003__Create_unique_constraint_on_person.cypher ├── sdn-and-causal-cluster │ ├── README.adoc │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── neo4j │ │ │ │ └── tips │ │ │ │ └── sdn │ │ │ │ └── causal_cluster │ │ │ │ ├── DemoApplication.java │ │ │ │ ├── app │ │ │ │ └── ThingController.java │ │ │ │ └── domain │ │ │ │ ├── Thing.java │ │ │ │ ├── ThingRepository.java │ │ │ │ └── ThingService.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── org │ │ └── neo4j │ │ └── tips │ │ └── sdn │ │ └── causal_cluster │ │ ├── DemoApplicationTest.java │ │ └── LBTest.java ├── sdn53WithEmbeddedNeo4jOverBolt │ ├── .gitignore │ ├── .mvn │ │ └── wrapper │ │ │ ├── MavenWrapperDownloader.java │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── org │ │ └── neo4j │ │ └── tips │ │ └── sdn │ │ └── sdn53withembeddedneo4joverbolt │ │ ├── Application.java │ │ ├── ExampleUsage.java │ │ ├── Neo4jConfig.java │ │ └── domain │ │ ├── Movie.java │ │ └── MovieRepository.java ├── sdn6-multidb-multi-connections-reactive │ ├── .gitignore │ ├── .mvn │ │ └── wrapper │ │ │ ├── MavenWrapperDownloader.java │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── neo4j │ │ │ │ └── tips │ │ │ │ └── sdn │ │ │ │ └── sdn6multidbmulticonnections │ │ │ │ ├── Example.java │ │ │ │ ├── Neo4jPropertiesConfig.java │ │ │ │ ├── Sdn6MultidbMultiConnectionsApplication.java │ │ │ │ ├── fitness │ │ │ │ ├── Whatever.java │ │ │ │ ├── WhateverConfig.java │ │ │ │ └── WhateverRepository.java │ │ │ │ ├── health │ │ │ │ ├── DatabaseSelectionAwareNeo4jReactiveHealthIndicator.java │ │ │ │ └── Neo4jHealthConfig.java │ │ │ │ └── movies │ │ │ │ ├── Movie.java │ │ │ │ ├── MovieRepository.java │ │ │ │ └── MoviesConfig.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── org │ │ └── neo4j │ │ └── tips │ │ └── sdn │ │ └── sdn6multidbmulticonnections │ │ └── Sdn6MultidbMultiConnectionsApplicationTests.java ├── sdn6-multidb-multi-connections │ ├── .gitignore │ ├── .mvn │ │ └── wrapper │ │ │ ├── MavenWrapperDownloader.java │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── neo4j │ │ │ │ └── tips │ │ │ │ └── sdn │ │ │ │ └── sdn6multidbmulticonnections │ │ │ │ ├── Example.java │ │ │ │ ├── Neo4jPropertiesConfig.java │ │ │ │ ├── Sdn6MultidbMultiConnectionsApplication.java │ │ │ │ ├── fitness │ │ │ │ ├── Whatever.java │ │ │ │ ├── WhateverConfig.java │ │ │ │ └── WhateverRepository.java │ │ │ │ ├── health │ │ │ │ ├── DatabaseSelectionAwareNeo4jHealthIndicator.java │ │ │ │ └── Neo4jHealthConfig.java │ │ │ │ └── movies │ │ │ │ ├── Movie.java │ │ │ │ ├── MovieRepository.java │ │ │ │ └── MoviesConfig.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── org │ │ └── neo4j │ │ └── tips │ │ └── sdn │ │ └── sdn6multidbmulticonnections │ │ └── Sdn6MultidbMultiConnectionsApplicationTests.java ├── sdn6-on-helidon │ ├── .dockerignore │ ├── Dockerfile │ ├── Dockerfile.jlink │ ├── Dockerfile.native │ ├── README.md │ ├── app.yaml │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── io │ │ │ │ └── helidon │ │ │ │ └── examples │ │ │ │ └── quickstart │ │ │ │ └── mp │ │ │ │ ├── GreetResource.java │ │ │ │ ├── GreetingProvider.java │ │ │ │ ├── Neo4jConfig.java │ │ │ │ ├── api │ │ │ │ └── MovieResource.java │ │ │ │ ├── domain │ │ │ │ ├── Actor.java │ │ │ │ ├── Movie.java │ │ │ │ ├── MovieRepository.java │ │ │ │ └── Person.java │ │ │ │ └── package-info.java │ │ └── resources │ │ │ ├── META-INF │ │ │ ├── beans.xml │ │ │ ├── microprofile-config.properties │ │ │ └── native-image │ │ │ │ └── reflect-config.json │ │ │ └── logging.properties │ │ └── test │ │ └── java │ │ └── io │ │ └── helidon │ │ └── examples │ │ └── quickstart │ │ └── mp │ │ └── MainTest.java ├── sdn6-on-liberty │ ├── README.adoc │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── ac │ │ │ └── simons │ │ │ └── neo4j │ │ │ └── sdn_on_liberty │ │ │ ├── GraphApplication.java │ │ │ ├── Neo4jConfig.java │ │ │ ├── api │ │ │ └── MovieResource.java │ │ │ └── domain │ │ │ ├── Actor.java │ │ │ ├── Movie.java │ │ │ ├── MovieRepository.java │ │ │ ├── Person.java │ │ │ └── Roles.java │ │ ├── liberty │ │ └── config │ │ │ └── server.xml │ │ └── resources │ │ └── META-INF │ │ └── beans.xml ├── sdn6-rest │ ├── .gitignore │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── neo4j │ │ │ │ └── tips │ │ │ │ └── sdn │ │ │ │ └── sdn6_rest │ │ │ │ ├── Application.java │ │ │ │ ├── SpringDataRestConfig.java │ │ │ │ └── movies │ │ │ │ ├── Actor.java │ │ │ │ ├── Movie.java │ │ │ │ ├── MovieRepository.java │ │ │ │ ├── PeopleRepository.java │ │ │ │ ├── Person.java │ │ │ │ └── PersonDetails.java │ │ └── resources │ │ │ └── neo4j │ │ │ └── migrations │ │ │ ├── V0001__Remove_old_indexes.cypher │ │ │ ├── V0002__Create_movie_title_index.cypher │ │ │ ├── V0003__Create_person_name_index.cypher │ │ │ └── V0004__Create_person_id_constraint.cypher │ │ └── test │ │ ├── java │ │ └── org │ │ │ └── neo4j │ │ │ └── tips │ │ │ └── sdn │ │ │ └── sdn6_rest │ │ │ └── ApplicationTest.java │ │ └── resources │ │ ├── example-data │ │ ├── afterMigrate__create_example_data.cypher │ │ └── beforeMigrate__clean_database.cypher │ │ └── logback-test.xml ├── sdn6 │ ├── .gitignore │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── neo4j │ │ │ │ └── tips │ │ │ │ └── sdn │ │ │ │ └── sdn6 │ │ │ │ ├── Application.java │ │ │ │ └── movies │ │ │ │ ├── Actor.java │ │ │ │ ├── Movie.java │ │ │ │ ├── MovieRepository.java │ │ │ │ ├── MoviesController.java │ │ │ │ ├── PeopleController.java │ │ │ │ ├── PeopleRepository.java │ │ │ │ ├── Person.java │ │ │ │ └── PersonDetails.java │ │ └── resources │ │ │ └── neo4j │ │ │ └── migrations │ │ │ ├── V0001__Remove_old_indexes.cypher │ │ │ ├── V0002__Create_movie_title_index.cypher │ │ │ ├── V0003__Create_person_name_index.cypher │ │ │ └── V0004__Create_person_id_constraint.cypher │ │ └── test │ │ ├── java │ │ └── org │ │ │ └── neo4j │ │ │ └── tips │ │ │ └── sdn │ │ │ └── sdn6 │ │ │ └── ApplicationTest.java │ │ └── resources │ │ ├── example-data │ │ ├── afterMigrate__create_example_data.cypher │ │ └── beforeMigrate__clean_database.cypher │ │ └── logback-test.xml ├── simple-quarkus │ ├── .dockerignore │ ├── .gitignore │ ├── .mvn │ │ └── wrapper │ │ │ ├── MavenWrapperDownloader.java │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── README.md │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ ├── requests.http │ └── src │ │ ├── main │ │ ├── docker │ │ │ ├── Dockerfile.fast-jar │ │ │ ├── Dockerfile.jvm │ │ │ └── Dockerfile.native │ │ ├── java │ │ │ └── org │ │ │ │ └── neo4j │ │ │ │ └── examples │ │ │ │ └── ArtistsResource.java │ │ └── resources │ │ │ ├── META-INF │ │ │ └── resources │ │ │ │ └── index.html │ │ │ ├── application.properties │ │ │ └── examples.cypher │ │ └── test │ │ └── java │ │ └── org │ │ └── neo4j │ │ └── examples │ │ ├── ArtistsResourceTest.java │ │ └── NativeArtistsResourceIT.java ├── spring-data-async │ ├── .gitignore │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── neo4j │ │ │ │ └── examples │ │ │ │ └── neo4j_from_the_jvm_ecoysystem │ │ │ │ └── springdataasync │ │ │ │ ├── AsyncConfiguration.java │ │ │ │ ├── AsyncCustomQueries.java │ │ │ │ ├── CustomQueries.java │ │ │ │ ├── Movie.java │ │ │ │ ├── MovieRepository.java │ │ │ │ ├── MovieService.java │ │ │ │ ├── OneClassSolution.java │ │ │ │ └── SpringDataAsyncApplication.java │ │ └── resources │ │ │ ├── application.properties │ │ │ └── neo4j │ │ │ └── migrations │ │ │ ├── afterMigrate.cypher │ │ │ └── beforeMigrate.cypher │ │ └── test │ │ ├── java │ │ └── org │ │ │ └── neo4j │ │ │ └── examples │ │ │ └── neo4j_from_the_jvm_ecoysystem │ │ │ └── springdataasync │ │ │ └── SpringDataAsyncApplicationTests.java │ │ └── resources │ │ └── logback-test.xml ├── testing-ogm-against-embedded-with-apoc │ ├── .gitignore │ ├── .mvn │ │ └── wrapper │ │ │ ├── MavenWrapperDownloader.java │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ ├── requests.http │ └── src │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── neo4j │ │ │ │ └── tips │ │ │ │ └── testing │ │ │ │ └── testing_ogm_against_embedded_with_apoc │ │ │ │ ├── ApocVersionContributor.java │ │ │ │ ├── Application.java │ │ │ │ ├── MovieController.java │ │ │ │ ├── MovieEntity.java │ │ │ │ └── MovieRepository.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ ├── java │ │ └── org │ │ │ └── neo4j │ │ │ └── tips │ │ │ └── testing │ │ │ └── testing_ogm_against_embedded_with_apoc │ │ │ └── ApplicationTests.java │ │ └── resources │ │ └── logback-test.xml ├── testing-ogm-against-testcontainers-with-apoc │ ├── .gitignore │ ├── .mvn │ │ └── wrapper │ │ │ ├── MavenWrapperDownloader.java │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ ├── requests.http │ └── src │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── neo4j │ │ │ │ └── tips │ │ │ │ └── testing │ │ │ │ └── testing_ogm_against_testcontainers_with_apoc │ │ │ │ ├── ApocVersionContributor.java │ │ │ │ ├── Application.java │ │ │ │ ├── MovieController.java │ │ │ │ ├── MovieEntity.java │ │ │ │ └── MovieRepository.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ ├── java │ │ └── org │ │ │ └── neo4j │ │ │ └── tips │ │ │ └── testing │ │ │ └── testing_ogm_against_testcontainers_with_apoc │ │ │ └── ApplicationTests.java │ │ └── resources │ │ └── logback-test.xml ├── understand-the-type-system │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── README.adoc │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── neo4j │ │ │ │ └── tips │ │ │ │ └── ogm │ │ │ │ └── understand_the_type_system │ │ │ │ └── TestNode.java │ │ └── resources │ │ │ └── simplelogger.properties │ │ └── test │ │ └── java │ │ └── org │ │ └── neo4j │ │ └── tips │ │ └── ogm │ │ └── understand_the_type_system │ │ ├── ReadViaAPICmd.java │ │ ├── ReadWithCypherViaBoltCmd.java │ │ ├── ReadWithCypherViaEmbeddedCmd.java │ │ ├── TypeConversionTest.java │ │ ├── WriteViaAPICmd.java │ │ ├── WriteWithCypherViaBoltCmd.java │ │ └── WriteWithCypherViaEmbeddedCmd.java ├── use-dynamic-finder │ ├── .gitignore │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── neo4j │ │ │ │ └── tips │ │ │ │ └── sdn │ │ │ │ └── use_dynamic_finder │ │ │ │ ├── UseDynamicFinderApplication.java │ │ │ │ ├── domain │ │ │ │ ├── Thing.java │ │ │ │ └── ThingRepository.java │ │ │ │ └── support │ │ │ │ └── Neo4jRepositoryWithDynamicFinderImpl.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── org │ │ └── neo4j │ │ └── tips │ │ └── sdn │ │ └── use_dynamic_finder │ │ └── support │ │ └── Neo4jRepositoryWithDynamicFinderImplTest.java ├── using-multiple-session-factories │ ├── .gitignore │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── README.adoc │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── neo4j │ │ │ │ └── tips │ │ │ │ └── sdn │ │ │ │ └── using_multiple_session_factories │ │ │ │ ├── DemoServiceUsingRepositories.java │ │ │ │ ├── DemoServiceUsingSession.java │ │ │ │ ├── UsingMultipleSessionFactoriesApplication.java │ │ │ │ ├── domain1 │ │ │ │ ├── Domain1Config.java │ │ │ │ ├── FooEntity.java │ │ │ │ └── FooRepository.java │ │ │ │ └── domain2 │ │ │ │ ├── BarEntity.java │ │ │ │ ├── BarRepository.java │ │ │ │ └── Domain2Config.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── org │ │ └── neo4j │ │ └── tips │ │ └── sdn │ │ └── using_multiple_session_factories │ │ └── UsingMultipleSessionFactoriesApplicationIT.java ├── using-testcontainers │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── neo4j │ │ │ └── tips │ │ │ └── testing │ │ │ └── using_testcontainers │ │ │ ├── DemoApplication.java │ │ │ └── domain │ │ │ ├── Thing.java │ │ │ ├── ThingRepository.java │ │ │ └── ThingWithGeometry.java │ │ └── test │ │ ├── java │ │ └── org │ │ │ └── neo4j │ │ │ └── tips │ │ │ └── testing │ │ │ └── using_testcontainers │ │ │ ├── PlainOGMTest.java │ │ │ └── SDNTest.java │ │ └── resources │ │ ├── geometry-toolbox.jar │ │ └── test-graph.db │ │ ├── neostore │ │ ├── neostore.counts.db.a │ │ ├── neostore.counts.db.b │ │ ├── neostore.id │ │ ├── neostore.labelscanstore.db │ │ ├── neostore.labeltokenstore.db │ │ ├── neostore.labeltokenstore.db.id │ │ ├── neostore.labeltokenstore.db.names │ │ ├── neostore.labeltokenstore.db.names.id │ │ ├── neostore.nodestore.db │ │ ├── neostore.nodestore.db.id │ │ ├── neostore.nodestore.db.labels │ │ ├── neostore.nodestore.db.labels.id │ │ ├── neostore.propertystore.db │ │ ├── neostore.propertystore.db.arrays │ │ ├── neostore.propertystore.db.arrays.id │ │ ├── neostore.propertystore.db.id │ │ ├── neostore.propertystore.db.index │ │ ├── neostore.propertystore.db.index.id │ │ ├── neostore.propertystore.db.index.keys │ │ ├── neostore.propertystore.db.index.keys.id │ │ ├── neostore.propertystore.db.strings │ │ ├── neostore.propertystore.db.strings.id │ │ ├── neostore.relationshipgroupstore.db │ │ ├── neostore.relationshipgroupstore.db.id │ │ ├── neostore.relationshipstore.db │ │ ├── neostore.relationshipstore.db.id │ │ ├── neostore.relationshiptypestore.db │ │ ├── neostore.relationshiptypestore.db.id │ │ ├── neostore.relationshiptypestore.db.names │ │ ├── neostore.relationshiptypestore.db.names.id │ │ ├── neostore.schemastore.db │ │ ├── neostore.schemastore.db.id │ │ └── neostore.transaction.db.0 ├── using-the-test-harness-ee │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── neo4j │ │ │ └── tips │ │ │ └── testing │ │ │ └── using_the_test_harness_ee │ │ │ └── DisplayMetadata.java │ │ └── test │ │ └── java │ │ └── org │ │ └── neo4j │ │ └── tips │ │ └── testing │ │ └── using_the_test_harness_ee │ │ └── DisplayMetadataTest.java ├── using-the-test-harness │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── neo4j │ │ │ └── tips │ │ │ └── testing │ │ │ └── using_the_test_harness │ │ │ ├── GetGeometry.java │ │ │ ├── GetPolygon.java │ │ │ └── LocationConversion.java │ │ └── test │ │ └── java │ │ └── org │ │ └── neo4j │ │ └── tips │ │ └── testing │ │ └── using_the_test_harness │ │ └── GeometryToolboxTest.java └── validate-transaction-settings │ ├── .gitignore │ ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── neo4j │ │ │ └── tips │ │ │ └── sdn │ │ │ └── validate_transaction_settings │ │ │ ├── BrokenService.java │ │ │ ├── ThingEntity.java │ │ │ ├── ThingRepository.java │ │ │ ├── TransactionManagerConfiguration.java │ │ │ ├── TransactionManagerConfigurationPlainSDN.java │ │ │ └── ValidateTransactionSettingsApplication.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── org │ └── neo4j │ └── tips │ └── sdn │ └── validate_transaction_settings │ └── BrokenServiceTest.java ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle └── src └── main └── asciidoc ├── images └── using_multiple_session_factories-properties-support.gif ├── ogm_sdn_knowledge_base.adoc ├── other_publications ├── neo4j-ogm-3.1.3-and-spring-data-lovelace-went-ga.adoc └── testing-your-neo4j-based-java-application.adoc ├── retries_through_space_and_time.adoc ├── sdn_and_causal_cluster.adoc ├── understand_the_type_system.adoc ├── use_dynamic_finder.adoc ├── using_multiple_session_factories.adoc ├── validate_transaction_settings.adoc └── what_are_the_building_blocks_of_sdn_and_ogm.adoc /.github/workflows/update_gh_pages.yml: -------------------------------------------------------------------------------- 1 | name: update_gh_pages 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | create: 8 | tags: 9 | - '*' 10 | 11 | jobs: 12 | update_gh_pages: 13 | if: github.event_name == 'push' || (github.event_name == 'create' && github.event.ref_type == 'tag') 14 | runs-on: ubuntu-latest 15 | steps: 16 | - uses: actions/checkout@v2 17 | - name: Set up JDK 18 | uses: actions/setup-java@v1 19 | with: 20 | java-version: 11 21 | - name: Install dita and co 22 | run: sudo apt-get install -y ditaa graphviz 23 | - name: Checkout gh-pages 24 | uses: actions/checkout@v2 25 | with: 26 | ref: gh-pages 27 | path: target/gh-pages 28 | - name: Run docs generation 29 | run: ./gradlew generateHtml && cp -prf build/html5/* target/gh-pages 30 | - name: Commit to gh-pages 31 | working-directory: ./target/gh-pages 32 | run: | 33 | git config --local user.email "action@github.com" 34 | git config --local user.name "GitHub Action" 35 | git add . 36 | git commit -m "Update GH-Pages." 37 | - name: Push changes 38 | uses: ad-m/github-push-action@v0.5.0 39 | with: 40 | directory: target/gh-pages 41 | branch: gh-pages 42 | github_token: ${{ secrets.GITHUB_TOKEN }} 43 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | 5 | .gradle 6 | build/ 7 | !gradle/wrapper/gradle-wrapper.jar 8 | 9 | ### STS ### 10 | .apt_generated 11 | .classpath 12 | .factorypath 13 | .project 14 | .settings 15 | .springBeans 16 | .sts4-cache 17 | 18 | ### IntelliJ IDEA ### 19 | .idea 20 | *.iws 21 | *.iml 22 | *.ipr 23 | 24 | ### NetBeans ### 25 | nbproject/private/ 26 | build/ 27 | nbbuild/ 28 | dist/ 29 | nbdist/ 30 | .nb-gradle/ -------------------------------------------------------------------------------- /etc/ide/README.adoc: -------------------------------------------------------------------------------- 1 | = Neo4j SDN and OGM Formatting Settings 2 | 3 | This directory contains `eclipse-formatting.xml` and `springdata.importorder` settings files to be used with Eclipse and IntelliJ. 4 | The settings are the same as used by https://github.com/spring-projects/spring-data-commons[Spring Data] with the minor difference having new lines after annotations on fields. 5 | 6 | == Eclipse Setup 7 | 8 | Import both files in Eclipse through the Preferences dialog. 9 | 10 | == IntelliJ Setup 11 | 12 | Use the IntelliJ https://plugins.jetbrains.com/plugin/6546-eclipse-code-formatter[Eclipse Code Formatter] plugin to configure code formatting and import ordering with the newest Eclipse formatter version. 13 | 14 | Additionally, make sure to configure your import settings in `Editor -> Code Style -> Java` with the following explicit settings: 15 | 16 | * Use tab character indents 17 | * Class count to use import with `*`: 10 18 | * Names count to use static import with `*`: 1 19 | -------------------------------------------------------------------------------- /etc/ide/springdata.importorder: -------------------------------------------------------------------------------- 1 | #Organize Import Order 2 | #Mon Nov 14 09:58:12 CET 2016 3 | 5=com 4 | 4=org 5 | 3=javax 6 | 2=java 7 | 1= 8 | 0=\# 9 | -------------------------------------------------------------------------------- /examples/bookmark-sync-plain-spring/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /examples/bookmark-sync-plain-spring/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michael-simons/neo4j-examples-and-tips/d1dace775ca88441d6680e2bb3a9c9e11edfa8fc/examples/bookmark-sync-plain-spring/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /examples/bookmark-sync-plain-spring/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /examples/bookmark-sync-plain-spring/src/main/java/org/neo4j/examples/jvm/spring/plain/imperative/Application.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.examples.jvm.spring.plain.imperative; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Application { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Application.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /examples/bookmark-sync-plain-spring/src/main/java/org/neo4j/examples/jvm/spring/plain/imperative/movies/Actor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2002-2020 "Neo4j," 3 | * Neo4j Sweden AB [http://neo4j.com] 4 | * 5 | * This file is part of Neo4j. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | package org.neo4j.examples.jvm.spring.plain.imperative.movies; 20 | 21 | import java.util.ArrayList; 22 | import java.util.Collections; 23 | import java.util.List; 24 | 25 | /** 26 | * @author Michael J. Simons 27 | */ 28 | public final class Actor { 29 | 30 | private final String name; 31 | 32 | private final List roles; 33 | 34 | public Actor(String name, final List roles) { 35 | this.name = name; 36 | this.roles = new ArrayList<>(roles); 37 | } 38 | 39 | public String getName() { 40 | return name; 41 | } 42 | 43 | public List getRoles() { 44 | return Collections.unmodifiableList(roles); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /examples/bookmark-sync-plain-spring/src/main/java/org/neo4j/examples/jvm/spring/plain/imperative/movies/MoviesController.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.examples.jvm.spring.plain.imperative.movies; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.web.bind.annotation.GetMapping; 6 | import org.springframework.web.bind.annotation.RequestMapping; 7 | import org.springframework.web.bind.annotation.RestController; 8 | 9 | /** 10 | * @author Michael J. Simons 11 | */ 12 | @RestController 13 | @RequestMapping("/api/movies") 14 | public final class MoviesController { 15 | 16 | private final MovieRepository movieRepository; 17 | 18 | MoviesController(MovieRepository movieRepository) { 19 | this.movieRepository = movieRepository; 20 | } 21 | 22 | @GetMapping({ "", "/" }) 23 | public List get() { 24 | return movieRepository.findAll(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /examples/bookmark-sync-plain-spring/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.neo4j.uri=bolt://localhost:7687 2 | spring.neo4j.authentication.username=neo4j 3 | spring.neo4j.authentication.password=secret 4 | 5 | spring.data.redis.repositories.enabled=false 6 | -------------------------------------------------------------------------------- /examples/bookmark-sync-sdn5/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /examples/bookmark-sync-sdn5/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michael-simons/neo4j-examples-and-tips/d1dace775ca88441d6680e2bb3a9c9e11edfa8fc/examples/bookmark-sync-sdn5/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /examples/bookmark-sync-sdn5/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.1/apache-maven-3.8.1-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /examples/bookmark-sync-sdn5/src/main/java/com/example/bookmarksyncsdn5/Application.java: -------------------------------------------------------------------------------- 1 | package com.example.bookmarksyncsdn5; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Application { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Application.class, args); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /examples/bookmark-sync-sdn5/src/main/java/com/example/bookmarksyncsdn5/movies/MovieRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2002-2020 "Neo4j," 3 | * Neo4j Sweden AB [http://neo4j.com] 4 | * 5 | * This file is part of Neo4j. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | package com.example.bookmarksyncsdn5.movies; 20 | 21 | import org.springframework.data.neo4j.annotation.UseBookmark; 22 | import org.springframework.data.neo4j.repository.Neo4jRepository; 23 | 24 | /** 25 | * @author Michael J. Simons 26 | */ 27 | interface MovieRepository extends Neo4jRepository { 28 | } 29 | -------------------------------------------------------------------------------- /examples/bookmark-sync-sdn5/src/main/java/com/example/bookmarksyncsdn5/movies/MoviesController.java: -------------------------------------------------------------------------------- 1 | package com.example.bookmarksyncsdn5.movies; 2 | 3 | import java.util.List; 4 | import java.util.stream.Collectors; 5 | import java.util.stream.StreamSupport; 6 | 7 | import org.springframework.data.domain.Sort; 8 | import org.springframework.web.bind.annotation.GetMapping; 9 | import org.springframework.web.bind.annotation.RequestMapping; 10 | import org.springframework.web.bind.annotation.RestController; 11 | 12 | /** 13 | * @author Michael J. Simons 14 | */ 15 | @RestController 16 | @RequestMapping("/api/movies") 17 | public final class MoviesController { 18 | 19 | private final MovieRepository movieRepository; 20 | 21 | MoviesController(MovieRepository movieRepository) { 22 | this.movieRepository = movieRepository; 23 | } 24 | 25 | @GetMapping({ "", "/" }) 26 | public List get() { 27 | return StreamSupport.stream(movieRepository.findAll(Sort.by("title").ascending()).spliterator(), false).collect( 28 | Collectors.toList()); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /examples/bookmark-sync-sdn5/src/main/java/com/example/bookmarksyncsdn5/movies/PeopleRepository.java: -------------------------------------------------------------------------------- 1 | package com.example.bookmarksyncsdn5.movies; 2 | 3 | import java.util.Optional; 4 | 5 | import org.springframework.data.neo4j.annotation.Query; 6 | import org.springframework.data.neo4j.annotation.UseBookmark; 7 | import org.springframework.data.neo4j.repository.Neo4jRepository; 8 | import org.springframework.transaction.annotation.Transactional; 9 | 10 | /** 11 | * @author Michael J. Simons 12 | */ 13 | interface PeopleRepository extends Neo4jRepository { 14 | 15 | @Query("MATCH (person:Person {name: $name})\n" 16 | + "OPTIONAL MATCH (person)-[:DIRECTED]->(d:Movie)\n" 17 | + "OPTIONAL MATCH (person)<-[r:ACTED_IN]->(a:Movie)\n" 18 | + "OPTIONAL MATCH (person)-->(movies)<-[relatedRole:ACTED_IN]-(relatedPerson)\n" 19 | + "RETURN DISTINCT person.name AS name, person.born AS born,\n" 20 | + "collect(DISTINCT d) AS directed,\n" 21 | + "collect(DISTINCT a) AS actedIn,\n" 22 | + "collect(DISTINCT relatedPerson) AS related\n") 23 | Optional getDetailsByName(String name); 24 | } 25 | -------------------------------------------------------------------------------- /examples/bookmark-sync-sdn5/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | org.neo4j.driver.uri=bolt://localhost:7687 2 | org.neo4j.driver.authentication.username=neo4j 3 | org.neo4j.driver.authentication.password=secret 4 | 5 | spring.data.redis.repositories.enabled=false 6 | -------------------------------------------------------------------------------- /examples/bookmark-sync-sdn6/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /examples/bookmark-sync-sdn6/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michael-simons/neo4j-examples-and-tips/d1dace775ca88441d6680e2bb3a9c9e11edfa8fc/examples/bookmark-sync-sdn6/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /examples/bookmark-sync-sdn6/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.1/apache-maven-3.8.1-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /examples/bookmark-sync-sdn6/src/main/java/com/example/bookmarksyncsdn6/Application.java: -------------------------------------------------------------------------------- 1 | package com.example.bookmarksyncsdn6; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Application { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Application.class, args); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /examples/bookmark-sync-sdn6/src/main/java/com/example/bookmarksyncsdn6/movies/MovieRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2002-2020 "Neo4j," 3 | * Neo4j Sweden AB [http://neo4j.com] 4 | * 5 | * This file is part of Neo4j. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | package com.example.bookmarksyncsdn6.movies; 20 | 21 | import org.springframework.data.neo4j.repository.Neo4jRepository; 22 | 23 | /** 24 | * @author Michael J. Simons 25 | */ 26 | interface MovieRepository extends Neo4jRepository { 27 | } 28 | -------------------------------------------------------------------------------- /examples/bookmark-sync-sdn6/src/main/java/com/example/bookmarksyncsdn6/movies/MoviesController.java: -------------------------------------------------------------------------------- 1 | package com.example.bookmarksyncsdn6.movies; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.data.domain.Sort; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.RestController; 9 | 10 | /** 11 | * @author Michael J. Simons 12 | */ 13 | @RestController 14 | @RequestMapping("/api/movies") 15 | public final class MoviesController { 16 | 17 | private final MovieRepository movieRepository; 18 | 19 | MoviesController(MovieRepository movieRepository) { 20 | this.movieRepository = movieRepository; 21 | } 22 | 23 | @GetMapping({ "", "/" }) 24 | public List get() { 25 | return movieRepository.findAll(Sort.by("title").ascending()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /examples/bookmark-sync-sdn6/src/main/java/com/example/bookmarksyncsdn6/movies/PeopleRepository.java: -------------------------------------------------------------------------------- 1 | package com.example.bookmarksyncsdn6.movies; 2 | 3 | import java.util.Optional; 4 | 5 | import org.springframework.data.neo4j.repository.Neo4jRepository; 6 | import org.springframework.data.neo4j.repository.query.Query; 7 | 8 | /** 9 | * @author Michael J. Simons 10 | */ 11 | interface PeopleRepository extends Neo4jRepository { 12 | 13 | @Query("MATCH (person:Person {name: $name})\n" 14 | + "OPTIONAL MATCH (person)-[:DIRECTED]->(d:Movie)\n" 15 | + "OPTIONAL MATCH (person)<-[r:ACTED_IN]->(a:Movie)\n" 16 | + "OPTIONAL MATCH (person)-->(movies)<-[relatedRole:ACTED_IN]-(relatedPerson)\n" 17 | + "RETURN DISTINCT person,\n" 18 | + "collect(DISTINCT d) AS directed,\n" 19 | + "collect(DISTINCT a) AS actedIn,\n" 20 | + "collect(DISTINCT relatedPerson) AS related") 21 | Optional getDetailsByName(String name); 22 | } 23 | -------------------------------------------------------------------------------- /examples/bookmark-sync-sdn6/src/main/java/com/example/bookmarksyncsdn6/movies/PersonDetails.java: -------------------------------------------------------------------------------- 1 | package com.example.bookmarksyncsdn6.movies; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Collections; 5 | import java.util.List; 6 | 7 | /** 8 | * This is a DTO based projection, containing a couple of additional details, 9 | * like the list of movies a person acted in, the movies they direct and which other 10 | * people they acted with 11 | * 12 | * @author Michael J. Simons 13 | */ 14 | public final class PersonDetails { 15 | 16 | private final String name; 17 | 18 | private final Integer born; 19 | 20 | private final List actedIn; 21 | 22 | private final List directed; 23 | 24 | private final List related; 25 | 26 | public PersonDetails(String name, Integer born, List actedIn, 27 | List directed, List related) { 28 | this.name = name; 29 | this.born = born; 30 | this.actedIn = new ArrayList<>(actedIn); 31 | this.directed = new ArrayList<>(directed); 32 | this.related = new ArrayList<>(related); 33 | } 34 | 35 | public String getName() { 36 | return name; 37 | } 38 | 39 | public Integer getBorn() { 40 | return born; 41 | } 42 | 43 | public List getActedIn() { 44 | return Collections.unmodifiableList(actedIn); 45 | } 46 | 47 | public List getDirected() { 48 | return Collections.unmodifiableList(directed); 49 | } 50 | 51 | public List getRelated() { 52 | return Collections.unmodifiableList(related); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /examples/bookmark-sync-sdn6/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.neo4j.uri=bolt://localhost:7687 2 | spring.neo4j.authentication.username=neo4j 3 | spring.neo4j.authentication.password=secret 4 | 5 | spring.data.redis.repositories.enabled=false 6 | -------------------------------------------------------------------------------- /examples/choosing-identifiers/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | /target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | 5 | ### STS ### 6 | .apt_generated 7 | .classpath 8 | .factorypath 9 | .project 10 | .settings 11 | .springBeans 12 | .sts4-cache 13 | 14 | ### IntelliJ IDEA ### 15 | .idea 16 | *.iws 17 | *.iml 18 | *.ipr 19 | 20 | ### NetBeans ### 21 | /nbproject/private/ 22 | /nbbuild/ 23 | /dist/ 24 | /nbdist/ 25 | /.nb-gradle/ 26 | /build/ 27 | 28 | ### VS Code ### 29 | .vscode/ 30 | -------------------------------------------------------------------------------- /examples/choosing-identifiers/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michael-simons/neo4j-examples-and-tips/d1dace775ca88441d6680e2bb3a9c9e11edfa8fc/examples/choosing-identifiers/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /examples/choosing-identifiers/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip 2 | -------------------------------------------------------------------------------- /examples/choosing-identifiers/src/main/java/org/neo4j/tips/ogm/choosing_identifier/BadPerson.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.ogm.choosing_identifier; 2 | 3 | import org.neo4j.ogm.annotation.GeneratedValue; 4 | import org.neo4j.ogm.annotation.Id; 5 | 6 | public class BadPerson { 7 | @Id @GeneratedValue 8 | private Long internalId; 9 | 10 | private Long id; 11 | 12 | public Long getInternalId() { 13 | return internalId; 14 | } 15 | 16 | public Long getId() { 17 | return id; 18 | } 19 | 20 | public void setId(Long id) { 21 | this.id = id; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /examples/choosing-identifiers/src/main/java/org/neo4j/tips/ogm/choosing_identifier/BadPersonRepository.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.ogm.choosing_identifier; 2 | 3 | import org.springframework.data.repository.CrudRepository; 4 | 5 | public interface BadPersonRepository extends CrudRepository { 6 | } 7 | -------------------------------------------------------------------------------- /examples/choosing-identifiers/src/main/java/org/neo4j/tips/ogm/choosing_identifier/DemoApplication.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.ogm.choosing_identifier; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class DemoApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(DemoApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /examples/choosing-identifiers/src/main/java/org/neo4j/tips/ogm/choosing_identifier/PersonWithExternalSurrogateKey.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.ogm.choosing_identifier; 2 | 3 | import java.util.UUID; 4 | 5 | import org.neo4j.ogm.annotation.GeneratedValue; 6 | import org.neo4j.ogm.annotation.Id; 7 | import org.neo4j.ogm.id.UuidStrategy; 8 | 9 | public class PersonWithExternalSurrogateKey { 10 | @Id @GeneratedValue(strategy = UuidStrategy.class) 11 | private UUID id; 12 | 13 | private String name; 14 | 15 | public UUID getId() { 16 | return id; 17 | } 18 | 19 | public String getName() { 20 | return name; 21 | } 22 | 23 | public void setName(String name) { 24 | this.name = name; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /examples/choosing-identifiers/src/main/java/org/neo4j/tips/ogm/choosing_identifier/PersonWithExternalSurrogateKeyRepository.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.ogm.choosing_identifier; 2 | 3 | import java.util.UUID; 4 | 5 | import org.springframework.data.repository.CrudRepository; 6 | 7 | public interface PersonWithExternalSurrogateKeyRepository 8 | extends CrudRepository { 9 | } 10 | -------------------------------------------------------------------------------- /examples/choosing-identifiers/src/main/java/org/neo4j/tips/ogm/choosing_identifier/PersonWithInternalSurrogateKey.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.ogm.choosing_identifier; 2 | 3 | import org.neo4j.ogm.annotation.GeneratedValue; 4 | import org.neo4j.ogm.annotation.Id; 5 | import org.neo4j.ogm.annotation.NodeEntity; 6 | 7 | @NodeEntity 8 | public class PersonWithInternalSurrogateKey { 9 | 10 | @Id @GeneratedValue 11 | private Long id; 12 | 13 | private String name; 14 | 15 | public Long getId() { 16 | return id; 17 | } 18 | 19 | public String getName() { 20 | return name; 21 | } 22 | 23 | public void setName(String name) { 24 | this.name = name; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /examples/choosing-identifiers/src/main/java/org/neo4j/tips/ogm/choosing_identifier/PersonWithInternalSurrogateKeyRepository.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.ogm.choosing_identifier; 2 | 3 | import org.springframework.data.repository.CrudRepository; 4 | 5 | public interface PersonWithInternalSurrogateKeyRepository 6 | extends CrudRepository { 7 | } 8 | -------------------------------------------------------------------------------- /examples/choosing-identifiers/src/main/java/org/neo4j/tips/ogm/choosing_identifier/TaxPayer.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.ogm.choosing_identifier; 2 | 3 | import java.util.Objects; 4 | 5 | import org.neo4j.ogm.annotation.Id; 6 | import org.neo4j.ogm.annotation.NodeEntity; 7 | 8 | @NodeEntity 9 | public class TaxPayer { 10 | @Id 11 | private String taxId; 12 | 13 | private String name; 14 | 15 | public TaxPayer(String taxId, String name) { 16 | this.taxId = taxId; 17 | this.name = name; 18 | } 19 | 20 | public String getTaxId() { 21 | return taxId; 22 | } 23 | 24 | public String getName() { 25 | return name; 26 | } 27 | 28 | public void setName(String name) { 29 | this.name = name; 30 | } 31 | 32 | @Override 33 | public boolean equals(Object o) { 34 | if (this == o) 35 | return true; 36 | if (!(o instanceof TaxPayer)) 37 | return false; 38 | TaxPayer taxPayer = (TaxPayer) o; 39 | return Objects.equals(taxId, taxPayer.taxId); 40 | } 41 | 42 | @Override 43 | public int hashCode() { 44 | return Objects.hash(taxId); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /examples/choosing-identifiers/src/main/java/org/neo4j/tips/ogm/choosing_identifier/TaxPayerRepository.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.ogm.choosing_identifier; 2 | 3 | import org.springframework.data.repository.CrudRepository; 4 | 5 | public interface TaxPayerRepository extends CrudRepository { 6 | } 7 | -------------------------------------------------------------------------------- /examples/choosing-identifiers/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /examples/choosing-identifiers/src/test/java/org/neo4j/tips/ogm/choosing_identifier/DemoApplicationTests.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.ogm.choosing_identifier; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class DemoApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /examples/micronaut-embedded-with-user-functions/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michael-simons/neo4j-examples-and-tips/d1dace775ca88441d6680e2bb3a9c9e11edfa8fc/examples/micronaut-embedded-with-user-functions/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /examples/micronaut-embedded-with-user-functions/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip -------------------------------------------------------------------------------- /examples/micronaut-embedded-with-user-functions/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:14-alpine 2 | COPY target/embedded_with_user_functions-*.jar embedded_with_user_functions.jar 3 | EXPOSE 8080 4 | CMD ["java", "-Dcom.sun.management.jmxremote", "-Xmx128m", "-jar", "embedded_with_user_functions.jar"] -------------------------------------------------------------------------------- /examples/micronaut-embedded-with-user-functions/README.md: -------------------------------------------------------------------------------- 1 | ## Micronaut + Neo4j embedded + Custom procedures 2 | 3 | ``` 4 | ./mvnw clean mn:run 5 | curl -X POST localhost:8080/createSomeData 6 | curl localhost:8080/callFunction 7 | ``` -------------------------------------------------------------------------------- /examples/micronaut-embedded-with-user-functions/micronaut-cli.yml: -------------------------------------------------------------------------------- 1 | applicationType: default 2 | defaultPackage: org.neo4j.tips.micronaut 3 | testFramework: junit 4 | sourceLanguage: java 5 | buildTool: maven 6 | features: [annotation-api, app-name, docker, file-watch, http-client, java, java-application, junit, logback, maven, netty-server, readme, shade, yaml] 7 | -------------------------------------------------------------------------------- /examples/micronaut-embedded-with-user-functions/src/main/java/org/neo4j/tips/micronaut/Application.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.micronaut; 2 | 3 | import io.micronaut.runtime.Micronaut; 4 | 5 | public class Application { 6 | 7 | public static void main(String[] args) { 8 | Micronaut.run(Application.class); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /examples/micronaut-embedded-with-user-functions/src/main/java/org/neo4j/tips/micronaut/Neo4jController.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.micronaut; 2 | 3 | import io.micronaut.http.annotation.Controller; 4 | import io.micronaut.http.annotation.Get; 5 | import io.micronaut.http.annotation.Post; 6 | 7 | import org.neo4j.dbms.api.DatabaseManagementService; 8 | import org.neo4j.graphdb.QueryStatistics; 9 | import org.neo4j.graphdb.Transaction; 10 | 11 | @Controller 12 | public class Neo4jController { 13 | 14 | private final DatabaseManagementService databaseManagementService; 15 | 16 | public Neo4jController(DatabaseManagementService databaseManagementService) { 17 | this.databaseManagementService = databaseManagementService; 18 | } 19 | 20 | // curl -X POST localhost:8080/createSomeData 21 | @Post("/createSomeData") 22 | QueryStatistics createSomeData() { 23 | try (Transaction tx = databaseManagementService.database("neo4j").beginTx()) { 24 | var result = tx.execute("CREATE (m:Test) RETURN m"); 25 | var queryStatistics = result.getQueryStatistics(); 26 | result.close(); 27 | return queryStatistics; 28 | } 29 | } 30 | 31 | // curl localhost:8080/callFunction 32 | @Get("/callFunction") 33 | String callFunction() { 34 | try (Transaction tx = databaseManagementService.database("neo4j").beginTx()) { 35 | var result = tx.execute("RETURN hello.micronaut() AS message"); 36 | var message = (String) result.next().get("message"); 37 | result.close(); 38 | return message; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /examples/micronaut-embedded-with-user-functions/src/main/java/org/neo4j/tips/micronaut/SomeCustomFunction.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.micronaut; 2 | 3 | import org.neo4j.procedure.UserFunction; 4 | 5 | public class SomeCustomFunction { 6 | 7 | @UserFunction("hello.micronaut") 8 | public String apply() { 9 | 10 | return "Hello, World.\n"; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /examples/micronaut-embedded-with-user-functions/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | micronaut: 2 | application: 3 | name: embedded_with_user_functions 4 | -------------------------------------------------------------------------------- /examples/micronaut-embedded-with-user-functions/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | true 5 | 7 | 8 | %cyan(%d{HH:mm:ss.SSS}) %gray([%thread]) %highlight(%-5level) %magenta(%logger{36}) - %msg%n 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /examples/micronaut-embedded-with-user-functions/src/test/java/org/neo4j/tips/micronaut/Embedded_with_user_functionsTest.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.micronaut; 2 | 3 | import io.micronaut.runtime.EmbeddedApplication; 4 | import io.micronaut.test.annotation.MicronautTest; 5 | import org.junit.jupiter.api.Test; 6 | import org.junit.jupiter.api.Assertions; 7 | 8 | import javax.inject.Inject; 9 | 10 | @MicronautTest 11 | public class Embedded_with_user_functionsTest { 12 | 13 | @Inject 14 | EmbeddedApplication application; 15 | 16 | @Test 17 | void testItWorks() { 18 | Assertions.assertTrue(application.isRunning()); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /examples/neo4j-and-helidon-se-reactive/.dockerignore: -------------------------------------------------------------------------------- 1 | target/* -------------------------------------------------------------------------------- /examples/neo4j-and-helidon-se-reactive/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "java.configuration.updateBuildConfiguration": "automatic" 3 | } -------------------------------------------------------------------------------- /examples/neo4j-and-helidon-se-reactive/Dockerfile: -------------------------------------------------------------------------------- 1 | 2 | # 1st stage, build the app 3 | FROM maven:3.6-jdk-11 as build 4 | 5 | WORKDIR /helidon 6 | 7 | # Create a first layer to cache the "Maven World" in the local repository. 8 | # Incremental docker builds will always resume after that, unless you update 9 | # the pom 10 | ADD pom.xml . 11 | RUN mvn package -Dmaven.test.skip -Declipselink.weave.skip 12 | 13 | # Do the Maven build! 14 | # Incremental docker builds will resume here when you change sources 15 | ADD src src 16 | RUN mvn package -DskipTests 17 | 18 | RUN echo "done!" 19 | 20 | # 2nd stage, build the runtime image 21 | FROM openjdk:11-jre-slim 22 | WORKDIR /helidon 23 | 24 | # Copy the binary built in the 1st stage 25 | COPY --from=build /helidon/target/helidon-quickstart-se.jar ./ 26 | COPY --from=build /helidon/target/libs ./libs 27 | 28 | CMD ["java", "-jar", "helidon-quickstart-se.jar"] 29 | 30 | EXPOSE 8080 31 | -------------------------------------------------------------------------------- /examples/neo4j-and-helidon-se-reactive/Dockerfile.jlink: -------------------------------------------------------------------------------- 1 | 2 | # 1st stage, build the app 3 | FROM maven:3.6.3-jdk-11-slim as build 4 | 5 | WORKDIR /helidon 6 | 7 | # Create a first layer to cache the "Maven World" in the local repository. 8 | # Incremental docker builds will always resume after that, unless you update 9 | # the pom 10 | ADD pom.xml . 11 | RUN mvn package -Dmaven.test.skip -Declipselink.weave.skip 12 | 13 | # Do the Maven build to create the custom Java Runtime Image 14 | # Incremental docker builds will resume here when you change sources 15 | ADD src src 16 | RUN mvn -Ddocker.build=true package -Pjlink-image -DskipTests 17 | RUN echo "done!" 18 | 19 | # 2nd stage, build the final image with the JRI built in the 1st stage 20 | 21 | FROM debian:stretch-slim 22 | WORKDIR /helidon 23 | COPY --from=build /helidon/target/helidon-quickstart-se ./ 24 | ENTRYPOINT ["/bin/bash", "/helidon/bin/start"] 25 | EXPOSE 8080 26 | -------------------------------------------------------------------------------- /examples/neo4j-and-helidon-se-reactive/Dockerfile.native: -------------------------------------------------------------------------------- 1 | 2 | # 1st stage, build the app 3 | FROM helidon/jdk11-graalvm-maven:20.1.0 as build 4 | 5 | WORKDIR /helidon 6 | 7 | # Create a first layer to cache the "Maven World" in the local repository. 8 | # Incremental docker builds will always resume after that, unless you update 9 | # the pom 10 | ADD pom.xml . 11 | RUN mvn package -Pnative-image -Dnative.image.skip -Dmaven.test.skip -Declipselink.weave.skip 12 | 13 | # Do the Maven build! 14 | # Incremental docker builds will resume here when you change sources 15 | ADD src src 16 | RUN mvn package -Pnative-image -Dnative.image.buildStatic -DskipTests 17 | 18 | RUN echo "done!" 19 | 20 | # 2nd stage, build the runtime image 21 | FROM scratch 22 | WORKDIR /helidon 23 | 24 | # Copy the binary built in the 1st stage 25 | COPY --from=build /helidon/target/helidon-quickstart-se . 26 | 27 | ENTRYPOINT ["./helidon-quickstart-se"] 28 | 29 | EXPOSE 8080 30 | -------------------------------------------------------------------------------- /examples/neo4j-and-helidon-se-reactive/src/main/java/io/helidon/examples/quickstart/se/api/MovieService.java: -------------------------------------------------------------------------------- 1 | package io.helidon.examples.quickstart.se.api; 2 | 3 | import io.helidon.examples.quickstart.se.domain.Movie; 4 | import io.helidon.examples.quickstart.se.domain.MovieRepository; 5 | import io.helidon.webserver.Routing; 6 | import io.helidon.webserver.ServerRequest; 7 | import io.helidon.webserver.ServerResponse; 8 | import io.helidon.webserver.Service; 9 | 10 | public class MovieService implements Service { 11 | 12 | private final MovieRepository movieRepository; 13 | 14 | public MovieService(final MovieRepository movieRepository) { 15 | this.movieRepository = movieRepository; 16 | } 17 | 18 | @Override 19 | public void update(Routing.Rules rules) { 20 | rules.get("/api/movies", this::findMoviesHandler); 21 | } 22 | 23 | private void findMoviesHandler(ServerRequest request, ServerResponse response) { 24 | var movies = this.movieRepository.findAll(); 25 | response.send(movies, Movie.class); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /examples/neo4j-and-helidon-se-reactive/src/main/java/io/helidon/examples/quickstart/se/domain/Actor.java: -------------------------------------------------------------------------------- 1 | package io.helidon.examples.quickstart.se.domain; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | /** 7 | * @author Michael J. Simons 8 | */ 9 | public class Actor { 10 | 11 | private final String name; 12 | 13 | private final List roles; 14 | 15 | public Actor(String name, final List roles) { 16 | this.name = name; 17 | this.roles = new ArrayList<>(roles); 18 | } 19 | 20 | public String getName() { 21 | return name; 22 | } 23 | 24 | public List getRoles() { 25 | return roles; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /examples/neo4j-and-helidon-se-reactive/src/main/java/io/helidon/examples/quickstart/se/domain/Movie.java: -------------------------------------------------------------------------------- 1 | package io.helidon.examples.quickstart.se.domain; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | 7 | /** 8 | * @author Mark Angrish 9 | * @author Michael J. Simons 10 | */ 11 | public class Movie { 12 | 13 | private final String title; 14 | 15 | private final String description; 16 | 17 | private List actors = new ArrayList<>(); 18 | 19 | private List directors = new ArrayList<>(); 20 | 21 | private Integer released; 22 | 23 | public Movie(String title, String description) { 24 | this.title = title; 25 | this.description = description; 26 | } 27 | 28 | public String getTitle() { 29 | return title; 30 | } 31 | 32 | public List getActors() { 33 | return actors; 34 | } 35 | 36 | public void setActors(List actors) { 37 | this.actors = actors; 38 | } 39 | 40 | public String getDescription() { 41 | return description; 42 | } 43 | 44 | public List getDirectors() { 45 | return directors; 46 | } 47 | 48 | public void setDirectorss(List directors) { 49 | this.directors = directors; 50 | } 51 | 52 | public Integer getReleased() { 53 | return released; 54 | } 55 | 56 | public void setReleased(Integer released) { 57 | this.released = released; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /examples/neo4j-and-helidon-se-reactive/src/main/java/io/helidon/examples/quickstart/se/domain/Person.java: -------------------------------------------------------------------------------- 1 | package io.helidon.examples.quickstart.se.domain; 2 | 3 | /** 4 | * @author Mark Angrish 5 | * @author Michael J. Simons 6 | */ 7 | public class Person { 8 | 9 | private final String name; 10 | 11 | private Integer born; 12 | 13 | public Person(Integer born, String name) { 14 | this.born = born; 15 | this.name = name; 16 | } 17 | 18 | public String getName() { 19 | return name; 20 | } 21 | 22 | public Integer getBorn() { 23 | return born; 24 | } 25 | 26 | public void setBorn(Integer born) { 27 | this.born = born; 28 | } 29 | 30 | @Override 31 | public String toString() { 32 | return "Person{" + 33 | "name='" + name + '\'' + 34 | ", born=" + born + 35 | '}'; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /examples/neo4j-and-helidon-se-reactive/src/main/java/io/helidon/examples/quickstart/se/package-info.java: -------------------------------------------------------------------------------- 1 | 2 | package io.helidon.examples.quickstart.se; 3 | -------------------------------------------------------------------------------- /examples/neo4j-and-helidon-se-reactive/src/main/resources/META-INF/native-image/reflect-config.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name" : "io.helidon.examples.quickstart.se.domain.Actor", 4 | "allPublicConstructors" : true, 5 | "allPublicMethods" : true 6 | }, 7 | { 8 | "name" : "io.helidon.examples.quickstart.se.domain.Movie", 9 | "allPublicConstructors" : true, 10 | "allPublicMethods" : true 11 | }, 12 | { 13 | "name" : "io.helidon.examples.quickstart.se.domain.Person", 14 | "allPublicConstructors" : true, 15 | "allPublicMethods" : true 16 | } 17 | ] -------------------------------------------------------------------------------- /examples/neo4j-and-helidon-se-reactive/src/main/resources/application.yaml: -------------------------------------------------------------------------------- 1 | 2 | app: 3 | greeting: "Hello" 4 | 5 | server: 6 | port: 8080 7 | host: 0.0.0.0 8 | 9 | 10 | neo4j: 11 | driver: 12 | uri: bolt://localhost:7687 13 | authentication: 14 | username: neo4j 15 | password: secret -------------------------------------------------------------------------------- /examples/neo4j-and-helidon-se-reactive/src/main/resources/logging.properties: -------------------------------------------------------------------------------- 1 | 2 | # Example Logging Configuration File 3 | # For more information see $JAVA_HOME/jre/lib/logging.properties 4 | 5 | # Send messages to the console 6 | handlers=io.helidon.common.HelidonConsoleHandler 7 | 8 | # HelidonConsoleHandler uses a SimpleFormatter subclass that replaces "!thread!" with the current thread 9 | java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$s %3$s !thread!: %5$s%6$s%n 10 | 11 | # Global logging level. Can be overridden by specific loggers 12 | .level=INFO 13 | 14 | # Component specific log levels 15 | #io.helidon.webserver.level=INFO 16 | #io.helidon.config.level=INFO 17 | #io.helidon.security.level=INFO 18 | #io.helidon.common.level=INFO 19 | #io.netty.level=INFO 20 | -------------------------------------------------------------------------------- /examples/neo4j-and-helidon-se/.dockerignore: -------------------------------------------------------------------------------- 1 | target/* -------------------------------------------------------------------------------- /examples/neo4j-and-helidon-se/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "java.configuration.updateBuildConfiguration": "automatic" 3 | } -------------------------------------------------------------------------------- /examples/neo4j-and-helidon-se/Dockerfile: -------------------------------------------------------------------------------- 1 | 2 | # 1st stage, build the app 3 | FROM maven:3.6-jdk-11 as build 4 | 5 | WORKDIR /helidon 6 | 7 | # Create a first layer to cache the "Maven World" in the local repository. 8 | # Incremental docker builds will always resume after that, unless you update 9 | # the pom 10 | ADD pom.xml . 11 | RUN mvn package -Dmaven.test.skip -Declipselink.weave.skip 12 | 13 | # Do the Maven build! 14 | # Incremental docker builds will resume here when you change sources 15 | ADD src src 16 | RUN mvn package -DskipTests 17 | 18 | RUN echo "done!" 19 | 20 | # 2nd stage, build the runtime image 21 | FROM openjdk:11-jre-slim 22 | WORKDIR /helidon 23 | 24 | # Copy the binary built in the 1st stage 25 | COPY --from=build /helidon/target/helidon-quickstart-se.jar ./ 26 | COPY --from=build /helidon/target/libs ./libs 27 | 28 | CMD ["java", "-jar", "helidon-quickstart-se.jar"] 29 | 30 | EXPOSE 8080 31 | -------------------------------------------------------------------------------- /examples/neo4j-and-helidon-se/Dockerfile.jlink: -------------------------------------------------------------------------------- 1 | 2 | # 1st stage, build the app 3 | FROM maven:3.6.3-jdk-11-slim as build 4 | 5 | WORKDIR /helidon 6 | 7 | # Create a first layer to cache the "Maven World" in the local repository. 8 | # Incremental docker builds will always resume after that, unless you update 9 | # the pom 10 | ADD pom.xml . 11 | RUN mvn package -Dmaven.test.skip -Declipselink.weave.skip 12 | 13 | # Do the Maven build to create the custom Java Runtime Image 14 | # Incremental docker builds will resume here when you change sources 15 | ADD src src 16 | RUN mvn -Ddocker.build=true package -Pjlink-image -DskipTests 17 | RUN echo "done!" 18 | 19 | # 2nd stage, build the final image with the JRI built in the 1st stage 20 | 21 | FROM debian:stretch-slim 22 | WORKDIR /helidon 23 | COPY --from=build /helidon/target/helidon-quickstart-se ./ 24 | ENTRYPOINT ["/bin/bash", "/helidon/bin/start"] 25 | EXPOSE 8080 26 | -------------------------------------------------------------------------------- /examples/neo4j-and-helidon-se/Dockerfile.native: -------------------------------------------------------------------------------- 1 | 2 | # 1st stage, build the app 3 | FROM helidon/jdk11-graalvm-maven:20.1.0 as build 4 | 5 | WORKDIR /helidon 6 | 7 | # Create a first layer to cache the "Maven World" in the local repository. 8 | # Incremental docker builds will always resume after that, unless you update 9 | # the pom 10 | ADD pom.xml . 11 | RUN mvn package -Pnative-image -Dnative.image.skip -Dmaven.test.skip -Declipselink.weave.skip 12 | 13 | # Do the Maven build! 14 | # Incremental docker builds will resume here when you change sources 15 | ADD src src 16 | RUN mvn package -Pnative-image -Dnative.image.buildStatic -DskipTests 17 | 18 | RUN echo "done!" 19 | 20 | # 2nd stage, build the runtime image 21 | FROM scratch 22 | WORKDIR /helidon 23 | 24 | # Copy the binary built in the 1st stage 25 | COPY --from=build /helidon/target/helidon-quickstart-se . 26 | 27 | ENTRYPOINT ["./helidon-quickstart-se"] 28 | 29 | EXPOSE 8080 30 | -------------------------------------------------------------------------------- /examples/neo4j-and-helidon-se/src/main/java/io/helidon/examples/quickstart/se/api/MovieService.java: -------------------------------------------------------------------------------- 1 | package io.helidon.examples.quickstart.se.api; 2 | 3 | import io.helidon.examples.quickstart.se.domain.MovieRepository; 4 | import io.helidon.webserver.Routing; 5 | import io.helidon.webserver.ServerRequest; 6 | import io.helidon.webserver.ServerResponse; 7 | import io.helidon.webserver.Service; 8 | 9 | public class MovieService implements Service { 10 | 11 | private final MovieRepository movieRepository; 12 | 13 | public MovieService(final MovieRepository movieRepository) { 14 | this.movieRepository = movieRepository; 15 | } 16 | 17 | @Override 18 | public void update(Routing.Rules rules) { 19 | rules.get("/api/movies", this::findMoviesHandler); 20 | } 21 | 22 | private void findMoviesHandler(ServerRequest request, ServerResponse response) { 23 | var movies = this.movieRepository.findAll(); 24 | response.send(movies); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /examples/neo4j-and-helidon-se/src/main/java/io/helidon/examples/quickstart/se/domain/Actor.java: -------------------------------------------------------------------------------- 1 | package io.helidon.examples.quickstart.se.domain; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | /** 7 | * @author Michael J. Simons 8 | */ 9 | public class Actor { 10 | 11 | private final String name; 12 | 13 | private final List roles; 14 | 15 | public Actor(String name, final List roles) { 16 | this.name = name; 17 | this.roles = new ArrayList<>(roles); 18 | } 19 | 20 | public String getName() { 21 | return name; 22 | } 23 | 24 | public List getRoles() { 25 | return roles; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /examples/neo4j-and-helidon-se/src/main/java/io/helidon/examples/quickstart/se/domain/Movie.java: -------------------------------------------------------------------------------- 1 | package io.helidon.examples.quickstart.se.domain; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | 7 | /** 8 | * @author Mark Angrish 9 | * @author Michael J. Simons 10 | */ 11 | public class Movie { 12 | 13 | private final String title; 14 | 15 | private final String description; 16 | 17 | private List actors = new ArrayList<>(); 18 | 19 | private List directors = new ArrayList<>(); 20 | 21 | private Integer released; 22 | 23 | public Movie(String title, String description) { 24 | this.title = title; 25 | this.description = description; 26 | } 27 | 28 | public String getTitle() { 29 | return title; 30 | } 31 | 32 | public List getActors() { 33 | return actors; 34 | } 35 | 36 | public void setActors(List actors) { 37 | this.actors = actors; 38 | } 39 | 40 | public String getDescription() { 41 | return description; 42 | } 43 | 44 | public List getDirectors() { 45 | return directors; 46 | } 47 | 48 | public void setDirectorss(List directors) { 49 | this.directors = directors; 50 | } 51 | 52 | public Integer getReleased() { 53 | return released; 54 | } 55 | 56 | public void setReleased(Integer released) { 57 | this.released = released; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /examples/neo4j-and-helidon-se/src/main/java/io/helidon/examples/quickstart/se/domain/Person.java: -------------------------------------------------------------------------------- 1 | package io.helidon.examples.quickstart.se.domain; 2 | 3 | /** 4 | * @author Mark Angrish 5 | * @author Michael J. Simons 6 | */ 7 | public class Person { 8 | 9 | private final String name; 10 | 11 | private Integer born; 12 | 13 | public Person(Integer born, String name) { 14 | this.born = born; 15 | this.name = name; 16 | } 17 | 18 | public String getName() { 19 | return name; 20 | } 21 | 22 | public Integer getBorn() { 23 | return born; 24 | } 25 | 26 | public void setBorn(Integer born) { 27 | this.born = born; 28 | } 29 | 30 | @Override 31 | public String toString() { 32 | return "Person{" + 33 | "name='" + name + '\'' + 34 | ", born=" + born + 35 | '}'; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /examples/neo4j-and-helidon-se/src/main/java/io/helidon/examples/quickstart/se/package-info.java: -------------------------------------------------------------------------------- 1 | 2 | package io.helidon.examples.quickstart.se; 3 | -------------------------------------------------------------------------------- /examples/neo4j-and-helidon-se/src/main/resources/META-INF/native-image/reflect-config.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name" : "io.helidon.examples.quickstart.se.domain.Actor", 4 | "allPublicConstructors" : true, 5 | "allPublicMethods" : true 6 | }, 7 | { 8 | "name" : "io.helidon.examples.quickstart.se.domain.Movie", 9 | "allPublicConstructors" : true, 10 | "allPublicMethods" : true 11 | }, 12 | { 13 | "name" : "io.helidon.examples.quickstart.se.domain.Person", 14 | "allPublicConstructors" : true, 15 | "allPublicMethods" : true 16 | } 17 | ] -------------------------------------------------------------------------------- /examples/neo4j-and-helidon-se/src/main/resources/application.yaml: -------------------------------------------------------------------------------- 1 | 2 | app: 3 | greeting: "Hello" 4 | 5 | server: 6 | port: 8080 7 | host: 0.0.0.0 8 | 9 | 10 | neo4j: 11 | uri: bolt://localhost:7687 12 | authentication: 13 | username: neo4j 14 | password: secret -------------------------------------------------------------------------------- /examples/neo4j-and-helidon-se/src/main/resources/logging.properties: -------------------------------------------------------------------------------- 1 | 2 | # Example Logging Configuration File 3 | # For more information see $JAVA_HOME/jre/lib/logging.properties 4 | 5 | # Send messages to the console 6 | handlers=io.helidon.common.HelidonConsoleHandler 7 | 8 | # HelidonConsoleHandler uses a SimpleFormatter subclass that replaces "!thread!" with the current thread 9 | java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$s %3$s !thread!: %5$s%6$s%n 10 | 11 | # Global logging level. Can be overridden by specific loggers 12 | .level=INFO 13 | 14 | # Component specific log levels 15 | #io.helidon.webserver.level=INFO 16 | #io.helidon.config.level=INFO 17 | #io.helidon.security.level=INFO 18 | #io.helidon.common.level=INFO 19 | #io.netty.level=INFO 20 | -------------------------------------------------------------------------------- /examples/retries-through-space-and-time/client/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michael-simons/neo4j-examples-and-tips/d1dace775ca88441d6680e2bb3a9c9e11edfa8fc/examples/retries-through-space-and-time/client/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /examples/retries-through-space-and-time/client/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /examples/retries-through-space-and-time/client/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.neo4j.tips.cluster 7 | client 8 | 0.0.1-SNAPSHOT 9 | client 10 | 11 | 11 12 | 13 | UTF-8 14 | ${java.version} 15 | ${java.version} 16 | 17 | 4.0.1 18 | 2.11.2 19 | 20 | 21 | 22 | 23 | 24 | com.fasterxml.jackson 25 | jackson-bom 26 | ${jackson-bom.version} 27 | pom 28 | import 29 | 30 | 31 | 32 | 33 | 34 | 35 | com.fasterxml.jackson.core 36 | jackson-databind 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /examples/retries-through-space-and-time/client/src/main/java/org/neo4j/tips/cluster/client/Movie.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.cluster.client; 2 | 3 | import com.fasterxml.jackson.annotation.JsonCreator; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | 6 | public class Movie { 7 | 8 | private final String title; 9 | 10 | @JsonCreator 11 | public Movie(@JsonProperty("title") String title) { 12 | this.title = title; 13 | } 14 | 15 | public String getTitle() { 16 | return title; 17 | } 18 | 19 | @Override public String toString() { 20 | return "Movie{" + 21 | "title='" + title + '\'' + 22 | '}'; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /examples/retries-through-space-and-time/driver_with_tx_function/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michael-simons/neo4j-examples-and-tips/d1dace775ca88441d6680e2bb3a9c9e11edfa8fc/examples/retries-through-space-and-time/driver_with_tx_function/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /examples/retries-through-space-and-time/driver_with_tx_function/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /examples/retries-through-space-and-time/driver_with_tx_function/src/main/java/org/neo4j/tips/cluster/driver_with_tx_function/Application.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.cluster.driver_with_tx_function; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Application { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Application.class, args); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /examples/retries-through-space-and-time/driver_with_tx_function/src/main/java/org/neo4j/tips/cluster/driver_with_tx_function/api/MovieController.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.cluster.driver_with_tx_function.api; 2 | 3 | import java.security.Principal; 4 | import java.util.Collection; 5 | 6 | import org.neo4j.tips.cluster.driver_with_tx_function.domain.Movie; 7 | import org.neo4j.tips.cluster.driver_with_tx_function.domain.MovieService; 8 | import org.springframework.web.bind.annotation.GetMapping; 9 | import org.springframework.web.bind.annotation.PostMapping; 10 | import org.springframework.web.bind.annotation.RequestBody; 11 | import org.springframework.web.bind.annotation.RequestMapping; 12 | import org.springframework.web.bind.annotation.RestController; 13 | 14 | @RestController 15 | @RequestMapping("/api/movies") 16 | public class MovieController { 17 | 18 | private final MovieService movieService; 19 | 20 | public MovieController(MovieService movieService) { 21 | this.movieService = movieService; 22 | } 23 | 24 | @GetMapping({ "", "/" }) 25 | public Collection getMovies() { 26 | return this.movieService.getAllMovies(); 27 | } 28 | 29 | @PostMapping("/watched") 30 | public Integer watched(Principal principal, @RequestBody String title) { 31 | 32 | return this.movieService.watchMovie(principal.getName(), title); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /examples/retries-through-space-and-time/driver_with_tx_function/src/main/java/org/neo4j/tips/cluster/driver_with_tx_function/config/SecurityConfig.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.cluster.driver_with_tx_function.config; 2 | 3 | import static org.springframework.boot.actuate.autoconfigure.security.servlet.EndpointRequest.to; 4 | 5 | import org.springframework.boot.actuate.health.HealthEndpoint; 6 | import org.springframework.boot.actuate.metrics.MetricsEndpoint; 7 | import org.springframework.context.annotation.Configuration; 8 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; 9 | import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; 10 | 11 | @Configuration 12 | public class SecurityConfig extends WebSecurityConfigurerAdapter { 13 | 14 | @Override 15 | protected void configure(HttpSecurity http) throws Exception { 16 | http.authorizeRequests() 17 | .antMatchers("/api/movies/watched").authenticated() 18 | .antMatchers("/api/movies", "/api/movies/").permitAll() 19 | .requestMatchers(to(HealthEndpoint.class, MetricsEndpoint.class)).permitAll() 20 | .and() 21 | .csrf().disable() 22 | .httpBasic(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /examples/retries-through-space-and-time/driver_with_tx_function/src/main/java/org/neo4j/tips/cluster/driver_with_tx_function/domain/Movie.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.cluster.driver_with_tx_function.domain; 2 | 3 | public class Movie { 4 | 5 | private final String title; 6 | 7 | public Movie(String title) { 8 | this.title = title; 9 | } 10 | 11 | public String getTitle() { 12 | return title; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /examples/retries-through-space-and-time/driver_with_tx_function/src/main/java/org/neo4j/tips/cluster/driver_with_tx_function/support/InsertRandom.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.cluster.driver_with_tx_function.support; 2 | 3 | import java.util.concurrent.ThreadLocalRandom; 4 | 5 | public final class InsertRandom { 6 | 7 | public static void delay() { 8 | 9 | try { 10 | Thread.sleep(ThreadLocalRandom.current().nextLong(1_001)); 11 | } catch (InterruptedException e) { 12 | } 13 | } 14 | 15 | private InsertRandom() { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /examples/retries-through-space-and-time/driver_with_tx_function/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.security.user.name=couchpotato 2 | spring.security.user.password=secret 3 | 4 | org.neo4j.driver.uri=bolt://localhost:7687 5 | org.neo4j.driver.authentication.username=neo4j 6 | org.neo4j.driver.authentication.password=secret 7 | 8 | org.neo4j.driver.pool.max-connection-lifetime=5m 9 | org.neo4j.driver.pool.metrics-enabled=true 10 | org.neo4j.driver.pool.log-leaked-sessions=true 11 | org.neo4j.driver.pool.max-connection-pool-size=1 12 | 13 | logging.level.org.neo4j.driver = info 14 | 15 | management.endpoints.web.exposure.include=* 16 | -------------------------------------------------------------------------------- /examples/retries-through-space-and-time/driver_with_tx_function/src/main/resources/neo4j/migrations/V0002__Create_unique_constraint_on_movies.cypher: -------------------------------------------------------------------------------- 1 | CREATE CONSTRAINT movies_unique_title 2 | ON (m:Movie) 3 | ASSERT m.title IS UNIQUE; 4 | -------------------------------------------------------------------------------- /examples/retries-through-space-and-time/driver_with_tx_function/src/main/resources/neo4j/migrations/V0003__Create_unique_constraint_on_person.cypher: -------------------------------------------------------------------------------- 1 | CREATE CONSTRAINT people_unique_name 2 | ON (p:Person) 3 | ASSERT p.name IS UNIQUE; 4 | -------------------------------------------------------------------------------- /examples/retries-through-space-and-time/sdn6/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michael-simons/neo4j-examples-and-tips/d1dace775ca88441d6680e2bb3a9c9e11edfa8fc/examples/retries-through-space-and-time/sdn6/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /examples/retries-through-space-and-time/sdn6/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /examples/retries-through-space-and-time/sdn6/src/main/java/org/neo4j/tips/cluster/sdn_ogm/Application.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.cluster.sdn_ogm; 2 | 3 | import io.github.resilience4j.retry.RetryRegistry; 4 | 5 | import org.apache.commons.logging.Log; 6 | import org.apache.commons.logging.LogFactory; 7 | import org.springframework.boot.SpringApplication; 8 | import org.springframework.boot.autoconfigure.SpringBootApplication; 9 | import org.springframework.core.log.LogMessage; 10 | 11 | @SpringBootApplication 12 | public class Application { 13 | 14 | private static final Log log = LogFactory.getLog(Application.class); 15 | 16 | public static void main(String[] args) { 17 | SpringApplication.run(Application.class, args); 18 | } 19 | 20 | public Application(RetryRegistry retryRegistry) { 21 | retryRegistry.retry("neo4j").getEventPublisher().onRetry(e -> log.warn(LogMessage.format("Retrying %s", e))); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /examples/retries-through-space-and-time/sdn6/src/main/java/org/neo4j/tips/cluster/sdn_ogm/api/MovieController.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.cluster.sdn_ogm.api; 2 | 3 | import java.security.Principal; 4 | import java.util.Collection; 5 | 6 | import org.neo4j.tips.cluster.sdn_ogm.domain.Movie; 7 | import org.neo4j.tips.cluster.sdn_ogm.domain.MovieService; 8 | import org.springframework.web.bind.annotation.GetMapping; 9 | import org.springframework.web.bind.annotation.PostMapping; 10 | import org.springframework.web.bind.annotation.RequestBody; 11 | import org.springframework.web.bind.annotation.RequestMapping; 12 | import org.springframework.web.bind.annotation.RestController; 13 | 14 | @RestController 15 | @RequestMapping("/api/movies") 16 | public class MovieController { 17 | 18 | private final MovieService movieService; 19 | 20 | public MovieController(MovieService movieService) { 21 | this.movieService = movieService; 22 | } 23 | 24 | @GetMapping({ "", "/" }) 25 | public Collection getMovies() { 26 | return this.movieService.getAllMovies(); 27 | } 28 | 29 | @PostMapping("/watched") 30 | public Integer watched(Principal principal, @RequestBody String title) { 31 | 32 | return this.movieService.watchMovie(principal.getName(), title); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /examples/retries-through-space-and-time/sdn6/src/main/java/org/neo4j/tips/cluster/sdn_ogm/config/SecurityConfig.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.cluster.sdn_ogm.config; 2 | 3 | import static org.springframework.boot.actuate.autoconfigure.security.servlet.EndpointRequest.to; 4 | 5 | import org.springframework.boot.actuate.health.HealthEndpoint; 6 | import org.springframework.boot.actuate.metrics.MetricsEndpoint; 7 | import org.springframework.context.annotation.Configuration; 8 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; 9 | import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; 10 | 11 | @Configuration 12 | public class SecurityConfig extends WebSecurityConfigurerAdapter { 13 | 14 | @Override 15 | protected void configure(HttpSecurity http) throws Exception { 16 | http.authorizeRequests() 17 | .antMatchers("/api/movies/watched").authenticated() 18 | .antMatchers("/api/movies", "/api/movies/").permitAll() 19 | .requestMatchers(to(HealthEndpoint.class, MetricsEndpoint.class)).permitAll() 20 | .and() 21 | .csrf().disable() 22 | .httpBasic(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /examples/retries-through-space-and-time/sdn6/src/main/java/org/neo4j/tips/cluster/sdn_ogm/domain/Movie.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.cluster.sdn_ogm.domain; 2 | 3 | import java.util.Objects; 4 | 5 | import org.springframework.data.neo4j.core.schema.GeneratedValue; 6 | import org.springframework.data.neo4j.core.schema.Id; 7 | import org.springframework.data.neo4j.core.schema.Node; 8 | 9 | @Node(primaryLabel = "Movie") 10 | public class Movie { 11 | 12 | @Id @GeneratedValue 13 | private Long id; 14 | 15 | private final String title; 16 | 17 | public Movie(String title) { 18 | this.title = title; 19 | } 20 | 21 | public Long getId() { 22 | return id; 23 | } 24 | 25 | public String getTitle() { 26 | return title; 27 | } 28 | 29 | @Override 30 | public boolean equals(Object o) { 31 | if (this == o) 32 | return true; 33 | if (o == null || getClass() != o.getClass()) 34 | return false; 35 | Movie movie = (Movie) o; 36 | return title.equals(movie.title); 37 | } 38 | 39 | @Override public int hashCode() { 40 | return Objects.hash(title); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /examples/retries-through-space-and-time/sdn6/src/main/java/org/neo4j/tips/cluster/sdn_ogm/domain/MovieService.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.cluster.sdn_ogm.domain; 2 | 3 | import java.util.Collection; 4 | 5 | public interface MovieService { 6 | 7 | Collection getAllMovies(); 8 | 9 | Integer watchMovie(String userName, String title); 10 | } 11 | -------------------------------------------------------------------------------- /examples/retries-through-space-and-time/sdn6/src/main/java/org/neo4j/tips/cluster/sdn_ogm/domain/User.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.cluster.sdn_ogm.domain; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | import org.springframework.data.neo4j.core.schema.GeneratedValue; 7 | import org.springframework.data.neo4j.core.schema.Id; 8 | import org.springframework.data.neo4j.core.schema.Node; 9 | import org.springframework.data.neo4j.core.schema.Relationship; 10 | 11 | @Node(primaryLabel = "Person") 12 | public class User { 13 | 14 | @Id @GeneratedValue 15 | private Long id; 16 | 17 | private final String name; 18 | 19 | @Relationship(type = "WATCHED") 20 | private Map watchedMovies = new HashMap<>(); 21 | 22 | public User(String name) { 23 | this.name = name; 24 | } 25 | 26 | public Long getId() { 27 | return id; 28 | } 29 | 30 | public String getName() { 31 | return name; 32 | } 33 | 34 | public Integer watch(Movie movie) { 35 | 36 | var watchedMovie = watchedMovies.computeIfAbsent(movie, k -> new WatchedMovie()); 37 | return watchedMovie.incrementAndGet(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /examples/retries-through-space-and-time/sdn6/src/main/java/org/neo4j/tips/cluster/sdn_ogm/domain/WatchedMovie.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.cluster.sdn_ogm.domain; 2 | 3 | import org.springframework.data.neo4j.core.schema.RelationshipProperties; 4 | 5 | @RelationshipProperties 6 | public class WatchedMovie { 7 | 8 | private Integer numberOfTimes = 0; 9 | 10 | public Integer getNumberOfTimes() { 11 | return numberOfTimes; 12 | } 13 | 14 | public Integer incrementAndGet() { 15 | return this.numberOfTimes += 1; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /examples/retries-through-space-and-time/sdn6/src/main/java/org/neo4j/tips/cluster/sdn_ogm/support/InsertRandom.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.cluster.sdn_ogm.support; 2 | 3 | import java.util.concurrent.ThreadLocalRandom; 4 | 5 | public final class InsertRandom { 6 | 7 | public static void delay() { 8 | 9 | try { 10 | Thread.sleep(ThreadLocalRandom.current().nextLong(1_001)); 11 | } catch (InterruptedException e) { 12 | } 13 | } 14 | 15 | private InsertRandom() { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /examples/retries-through-space-and-time/sdn6/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.security.user.name=couchpotato 2 | spring.security.user.password=secret 3 | 4 | spring.neo4j.uri=bolt://localhost:7687 5 | spring.neo4j.authentication.username=neo4j 6 | spring.neo4j.authentication.password=secret 7 | 8 | spring.neo4j.pool.max-connection-lifetime=5m 9 | spring.neo4j.pool.metrics-enabled=true 10 | spring.neo4j.pool.log-leaked-sessions=true 11 | spring.neo4j.pool.max-connection-pool-size=1 12 | 13 | logging.level.org.neo4j.driver = info 14 | # logging.level.org.springframework.data.neo4j.cypher = trace 15 | 16 | management.endpoints.web.exposure.include=* 17 | 18 | resilience4j.retry.configs.default.max-retry-attempts=10 19 | resilience4j.retry.configs.default.wait-duration=1s 20 | resilience4j.retry.configs.default.retry-exceptions=org.neo4j.driver.exceptions.SessionExpiredException,org.neo4j.driver.exceptions.ServiceUnavailableException 21 | resilience4j.retry.configs.default.retry-exception-predicate=org.neo4j.tips.cluster.sdn_ogm.support.RetrySDN6ExceptionPredicate 22 | # Only to make log entries appear immediate 23 | resilience4j.retry.configs.default.event-consumer-buffer-size=1 24 | 25 | resilience4j.retry.instances.neo4j.base-config=default 26 | 27 | -------------------------------------------------------------------------------- /examples/retries-through-space-and-time/sdn6/src/main/resources/neo4j/migrations/V0002__Create_unique_constraint_on_movies.cypher: -------------------------------------------------------------------------------- 1 | CREATE CONSTRAINT movies_unique_title 2 | ON (m:Movie) 3 | ASSERT m.title IS UNIQUE; 4 | -------------------------------------------------------------------------------- /examples/retries-through-space-and-time/sdn6/src/main/resources/neo4j/migrations/V0003__Create_unique_constraint_on_person.cypher: -------------------------------------------------------------------------------- 1 | CREATE CONSTRAINT people_unique_name 2 | ON (p:Person) 3 | ASSERT p.name IS UNIQUE; 4 | -------------------------------------------------------------------------------- /examples/retries-through-space-and-time/sdn_ogm/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michael-simons/neo4j-examples-and-tips/d1dace775ca88441d6680e2bb3a9c9e11edfa8fc/examples/retries-through-space-and-time/sdn_ogm/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /examples/retries-through-space-and-time/sdn_ogm/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /examples/retries-through-space-and-time/sdn_ogm/src/main/java/org/neo4j/tips/cluster/sdn_ogm/Application.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.cluster.sdn_ogm; 2 | 3 | import io.github.resilience4j.retry.RetryRegistry; 4 | 5 | import org.apache.commons.logging.Log; 6 | import org.apache.commons.logging.LogFactory; 7 | import org.springframework.boot.SpringApplication; 8 | import org.springframework.boot.autoconfigure.SpringBootApplication; 9 | import org.springframework.core.log.LogMessage; 10 | 11 | @SpringBootApplication 12 | public class Application { 13 | 14 | private static final Log log = LogFactory.getLog(Application.class); 15 | 16 | public static void main(String[] args) { 17 | SpringApplication.run(Application.class, args); 18 | } 19 | 20 | public Application(RetryRegistry retryRegistry) { 21 | retryRegistry.retry("neo4j").getEventPublisher().onRetry(e -> log.warn(LogMessage.format("Retrying %s", e))); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /examples/retries-through-space-and-time/sdn_ogm/src/main/java/org/neo4j/tips/cluster/sdn_ogm/api/MovieController.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.cluster.sdn_ogm.api; 2 | 3 | import java.security.Principal; 4 | import java.util.Collection; 5 | 6 | import org.neo4j.tips.cluster.sdn_ogm.domain.Movie; 7 | import org.neo4j.tips.cluster.sdn_ogm.domain.MovieService; 8 | import org.springframework.web.bind.annotation.GetMapping; 9 | import org.springframework.web.bind.annotation.PostMapping; 10 | import org.springframework.web.bind.annotation.RequestBody; 11 | import org.springframework.web.bind.annotation.RequestMapping; 12 | import org.springframework.web.bind.annotation.RestController; 13 | 14 | @RestController 15 | @RequestMapping("/api/movies") 16 | public class MovieController { 17 | 18 | private final MovieService movieService; 19 | 20 | public MovieController(MovieService movieService) { 21 | this.movieService = movieService; 22 | } 23 | 24 | @GetMapping({ "", "/" }) 25 | public Collection getMovies() { 26 | return this.movieService.getAllMovies(); 27 | } 28 | 29 | @PostMapping("/watched") 30 | public Integer watched(Principal principal, @RequestBody String title) { 31 | 32 | return this.movieService.watchMovie(principal.getName(), title); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /examples/retries-through-space-and-time/sdn_ogm/src/main/java/org/neo4j/tips/cluster/sdn_ogm/config/SecurityConfig.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.cluster.sdn_ogm.config; 2 | 3 | import static org.springframework.boot.actuate.autoconfigure.security.servlet.EndpointRequest.to; 4 | 5 | import org.springframework.boot.actuate.health.HealthEndpoint; 6 | import org.springframework.boot.actuate.metrics.MetricsEndpoint; 7 | import org.springframework.context.annotation.Configuration; 8 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; 9 | import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; 10 | 11 | @Configuration 12 | public class SecurityConfig extends WebSecurityConfigurerAdapter { 13 | 14 | @Override 15 | protected void configure(HttpSecurity http) throws Exception { 16 | http.authorizeRequests() 17 | .antMatchers("/api/movies/watched").authenticated() 18 | .antMatchers("/api/movies", "/api/movies/").permitAll() 19 | .requestMatchers(to(HealthEndpoint.class, MetricsEndpoint.class)).permitAll() 20 | .and() 21 | .csrf().disable() 22 | .httpBasic(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /examples/retries-through-space-and-time/sdn_ogm/src/main/java/org/neo4j/tips/cluster/sdn_ogm/domain/Movie.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.cluster.sdn_ogm.domain; 2 | 3 | import java.util.Objects; 4 | 5 | import org.neo4j.ogm.annotation.GeneratedValue; 6 | import org.neo4j.ogm.annotation.Id; 7 | import org.neo4j.ogm.annotation.NodeEntity; 8 | 9 | @NodeEntity(label = "Movie") 10 | public class Movie { 11 | 12 | @Id @GeneratedValue 13 | private Long id; 14 | 15 | private String title; 16 | 17 | Movie() { 18 | } 19 | 20 | public Movie(String title) { 21 | this.title = title; 22 | } 23 | 24 | public Long getId() { 25 | return id; 26 | } 27 | 28 | public String getTitle() { 29 | return title; 30 | } 31 | 32 | @Override 33 | public boolean equals(Object o) { 34 | if (this == o) 35 | return true; 36 | if (o == null || getClass() != o.getClass()) 37 | return false; 38 | Movie movie = (Movie) o; 39 | return title.equals(movie.title); 40 | } 41 | 42 | @Override public int hashCode() { 43 | return Objects.hash(title); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /examples/retries-through-space-and-time/sdn_ogm/src/main/java/org/neo4j/tips/cluster/sdn_ogm/domain/MovieService.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.cluster.sdn_ogm.domain; 2 | 3 | import java.util.Collection; 4 | 5 | public interface MovieService { 6 | 7 | Collection getAllMovies(); 8 | 9 | Integer watchMovie(String userName, String title); 10 | } 11 | -------------------------------------------------------------------------------- /examples/retries-through-space-and-time/sdn_ogm/src/main/java/org/neo4j/tips/cluster/sdn_ogm/domain/User.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.cluster.sdn_ogm.domain; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import org.neo4j.ogm.annotation.GeneratedValue; 7 | import org.neo4j.ogm.annotation.Id; 8 | import org.neo4j.ogm.annotation.NodeEntity; 9 | import org.neo4j.ogm.annotation.Relationship; 10 | 11 | @NodeEntity(label = "Person") 12 | public class User { 13 | 14 | @Id @GeneratedValue 15 | private Long id; 16 | 17 | private String name; 18 | 19 | @Relationship(type = "WATCHED") 20 | private List watchedMovies = new ArrayList<>(); 21 | 22 | User() { 23 | } 24 | 25 | public User(String name) { 26 | this.name = name; 27 | } 28 | 29 | public Long getId() { 30 | return id; 31 | } 32 | 33 | public String getName() { 34 | return name; 35 | } 36 | 37 | public Integer watch(Movie movie) { 38 | 39 | var potentiallyWatchedMovie = watchedMovies.stream().filter(wm -> wm.getMovie().equals(movie)).findFirst(); 40 | if (potentiallyWatchedMovie.isPresent()) { 41 | return potentiallyWatchedMovie.get().incrementAndGet(); 42 | } else { 43 | var numberOfTimes = 1; 44 | watchedMovies.add(new WatchedMovie(this, movie, numberOfTimes)); 45 | return numberOfTimes; 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /examples/retries-through-space-and-time/sdn_ogm/src/main/java/org/neo4j/tips/cluster/sdn_ogm/domain/WatchedMovie.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.cluster.sdn_ogm.domain; 2 | 3 | import org.neo4j.ogm.annotation.EndNode; 4 | import org.neo4j.ogm.annotation.GeneratedValue; 5 | import org.neo4j.ogm.annotation.Id; 6 | import org.neo4j.ogm.annotation.RelationshipEntity; 7 | import org.neo4j.ogm.annotation.StartNode; 8 | 9 | @RelationshipEntity(type = "WATCHED") 10 | public class WatchedMovie { 11 | 12 | @Id @GeneratedValue private Long id; 13 | 14 | @StartNode private User user; 15 | 16 | @EndNode private Movie movie; 17 | 18 | private Integer numberOfTimes = 0; 19 | 20 | WatchedMovie() { 21 | } 22 | 23 | public WatchedMovie(User user, Movie movie, Integer numberOfTimes) { 24 | this.user = user; 25 | this.movie = movie; 26 | this.numberOfTimes = numberOfTimes; 27 | } 28 | 29 | public Long getId() { 30 | return id; 31 | } 32 | 33 | public Integer getNumberOfTimes() { 34 | return numberOfTimes; 35 | } 36 | 37 | public Integer incrementAndGet() { 38 | return this.numberOfTimes += 1; 39 | } 40 | 41 | public User getUser() { 42 | return user; 43 | } 44 | 45 | public Movie getMovie() { 46 | return movie; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /examples/retries-through-space-and-time/sdn_ogm/src/main/java/org/neo4j/tips/cluster/sdn_ogm/support/InsertRandom.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.cluster.sdn_ogm.support; 2 | 3 | import java.util.concurrent.ThreadLocalRandom; 4 | 5 | public final class InsertRandom { 6 | 7 | public static void delay() { 8 | 9 | try { 10 | Thread.sleep(ThreadLocalRandom.current().nextLong(1_001)); 11 | } catch (InterruptedException e) { 12 | } 13 | } 14 | 15 | private InsertRandom() { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /examples/retries-through-space-and-time/sdn_ogm/src/main/java/org/neo4j/tips/cluster/sdn_ogm/support/RetryOGMSDNExceptionPredicate.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.cluster.sdn_ogm.support; 2 | 3 | import java.util.function.Predicate; 4 | 5 | import org.neo4j.driver.exceptions.ServiceUnavailableException; 6 | import org.neo4j.driver.exceptions.SessionExpiredException; 7 | import org.neo4j.driver.exceptions.TransientException; 8 | import org.neo4j.ogm.exception.CypherException; 9 | 10 | public class RetryOGMSDNExceptionPredicate implements Predicate { 11 | 12 | @Override 13 | public boolean test(Throwable throwable) { 14 | 15 | Throwable ex = throwable; 16 | if (throwable instanceof CypherException) { 17 | ex = throwable.getCause(); 18 | } 19 | 20 | if (ex instanceof TransientException) { 21 | String code = ((TransientException) ex).code(); 22 | return !"Neo.TransientError.Transaction.Terminated".equals(code) && 23 | !"Neo.TransientError.Transaction.LockClientStopped".equals(code); 24 | } else { 25 | return ex instanceof SessionExpiredException || ex instanceof ServiceUnavailableException; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /examples/retries-through-space-and-time/sdn_ogm/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.security.user.name=couchpotato 2 | spring.security.user.password=secret 3 | 4 | org.neo4j.driver.uri=bolt://localhost:7687 5 | org.neo4j.driver.authentication.username=neo4j 6 | org.neo4j.driver.authentication.password=secret 7 | 8 | org.neo4j.driver.pool.max-connection-lifetime=5m 9 | org.neo4j.driver.pool.metrics-enabled=true 10 | org.neo4j.driver.pool.log-leaked-sessions=true 11 | org.neo4j.driver.pool.max-connection-pool-size=1 12 | 13 | logging.level.org.neo4j.driver = info 14 | 15 | management.endpoints.web.exposure.include=* 16 | 17 | resilience4j.retry.configs.default.max-retry-attempts=10 18 | resilience4j.retry.configs.default.wait-duration=1s 19 | resilience4j.retry.configs.default.retry-exceptions=org.neo4j.driver.exceptions.SessionExpiredException,org.neo4j.driver.exceptions.ServiceUnavailableException 20 | resilience4j.retry.configs.default.retry-exception-predicate=org.neo4j.tips.cluster.sdn_ogm.support.RetryOGMSDNExceptionPredicate 21 | # Only to make log entries appear immediate 22 | resilience4j.retry.configs.default.event-consumer-buffer-size=1 23 | 24 | resilience4j.retry.instances.neo4j.base-config=default 25 | -------------------------------------------------------------------------------- /examples/retries-through-space-and-time/sdn_ogm/src/main/resources/neo4j/migrations/V0002__Create_unique_constraint_on_movies.cypher: -------------------------------------------------------------------------------- 1 | CREATE CONSTRAINT movies_unique_title 2 | ON (m:Movie) 3 | ASSERT m.title IS UNIQUE; 4 | -------------------------------------------------------------------------------- /examples/retries-through-space-and-time/sdn_ogm/src/main/resources/neo4j/migrations/V0003__Create_unique_constraint_on_person.cypher: -------------------------------------------------------------------------------- 1 | CREATE CONSTRAINT people_unique_name 2 | ON (p:Person) 3 | ASSERT p.name IS UNIQUE; 4 | -------------------------------------------------------------------------------- /examples/sdn-and-causal-cluster/README.adoc: -------------------------------------------------------------------------------- 1 | = sdn-and-causal-cluster 2 | 3 | This example uses the https://github.com/michael-simons/junit-jupiter-causal-cluster-testcontainer-extension[JUnit Jupiter Causal Cluster Testcontainer extension]. 4 | You'll need an installed https://www.docker.com[Docker] on your machine to use this project. 5 | -------------------------------------------------------------------------------- /examples/sdn-and-causal-cluster/src/main/java/org/neo4j/tips/sdn/causal_cluster/domain/ThingRepository.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.sdn.causal_cluster.domain; 2 | 3 | import java.util.List; 4 | import java.util.Optional; 5 | 6 | import org.springframework.data.neo4j.repository.Neo4jRepository; 7 | 8 | /** 9 | * @author Michael J. Simons 10 | */ 11 | public interface ThingRepository extends Neo4jRepository { 12 | Optional findOneBySequenceNumber(Long sequenceNumber); 13 | 14 | List findAllBySequenceNumberGreaterThanEqual(long currentSequence); 15 | } 16 | -------------------------------------------------------------------------------- /examples/sdn-and-causal-cluster/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | # spring.data.neo4j.uri=bolt+routing://your-cluster-member:7687 2 | 3 | resilience4j.retry.configs.default.max-retry-attempts= 3 4 | resilience4j.retry.configs.default.wait-duration= 100 5 | resilience4j.retry.configs.default.retry-exceptions=org.neo4j.driver.exceptions.SessionExpiredException,org.neo4j.driver.exceptions.ServiceUnavailableException,org.neo4j.driver.exceptions.TransientException 6 | resilience4j.retry.instances.neo4j.base-config=default 7 | -------------------------------------------------------------------------------- /examples/sdn53WithEmbeddedNeo4jOverBolt/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /examples/sdn53WithEmbeddedNeo4jOverBolt/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michael-simons/neo4j-examples-and-tips/d1dace775ca88441d6680e2bb3a9c9e11edfa8fc/examples/sdn53WithEmbeddedNeo4jOverBolt/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /examples/sdn53WithEmbeddedNeo4jOverBolt/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.1/apache-maven-3.8.1-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /examples/sdn53WithEmbeddedNeo4jOverBolt/src/main/java/org/neo4j/tips/sdn/sdn53withembeddedneo4joverbolt/Application.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.sdn.sdn53withembeddedneo4joverbolt; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Application { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Application.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /examples/sdn53WithEmbeddedNeo4jOverBolt/src/main/java/org/neo4j/tips/sdn/sdn53withembeddedneo4joverbolt/ExampleUsage.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.sdn.sdn53withembeddedneo4joverbolt; 2 | 3 | import org.neo4j.tips.sdn.sdn53withembeddedneo4joverbolt.domain.Movie; 4 | import org.neo4j.tips.sdn.sdn53withembeddedneo4joverbolt.domain.MovieRepository; 5 | import org.springframework.boot.CommandLineRunner; 6 | import org.springframework.stereotype.Component; 7 | 8 | @Component 9 | public class ExampleUsage implements CommandLineRunner { 10 | 11 | private final MovieRepository movieRepository; 12 | 13 | public ExampleUsage(MovieRepository movieRepository) { 14 | this.movieRepository = movieRepository; 15 | } 16 | 17 | @Override 18 | public void run(String... args) { 19 | 20 | var movie = movieRepository.save(new Movie("One flew over the coconest")); 21 | System.out.println("Saved a movie: " + movie); 22 | System.exit(0); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /examples/sdn53WithEmbeddedNeo4jOverBolt/src/main/java/org/neo4j/tips/sdn/sdn53withembeddedneo4joverbolt/domain/Movie.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.sdn.sdn53withembeddedneo4joverbolt.domain; 2 | 3 | import org.neo4j.ogm.annotation.GeneratedValue; 4 | import org.neo4j.ogm.annotation.Id; 5 | import org.neo4j.ogm.annotation.NodeEntity; 6 | 7 | @NodeEntity 8 | public class Movie { 9 | @Id 10 | @GeneratedValue 11 | private Long id; 12 | 13 | private final String title; 14 | 15 | public Movie(String title) { 16 | this.title = title; 17 | } 18 | 19 | public Long getId() { 20 | return id; 21 | } 22 | 23 | public String getTitle() { 24 | return title; 25 | } 26 | 27 | @Override 28 | public String toString() { 29 | return "Movie{" + 30 | "id=" + id + 31 | ", title='" + title + '\'' + 32 | '}'; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /examples/sdn53WithEmbeddedNeo4jOverBolt/src/main/java/org/neo4j/tips/sdn/sdn53withembeddedneo4joverbolt/domain/MovieRepository.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.sdn.sdn53withembeddedneo4joverbolt.domain; 2 | 3 | import org.springframework.data.neo4j.repository.Neo4jRepository; 4 | 5 | public interface MovieRepository extends Neo4jRepository { 6 | } 7 | -------------------------------------------------------------------------------- /examples/sdn6-multidb-multi-connections-reactive/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /examples/sdn6-multidb-multi-connections-reactive/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michael-simons/neo4j-examples-and-tips/d1dace775ca88441d6680e2bb3a9c9e11edfa8fc/examples/sdn6-multidb-multi-connections-reactive/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /examples/sdn6-multidb-multi-connections-reactive/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /examples/sdn6-multidb-multi-connections-reactive/src/main/java/org/neo4j/tips/sdn/sdn6multidbmulticonnections/Neo4jPropertiesConfig.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.sdn.sdn6multidbmulticonnections; 2 | 3 | import org.springframework.boot.autoconfigure.data.neo4j.Neo4jDataProperties; 4 | import org.springframework.boot.autoconfigure.neo4j.Neo4jProperties; 5 | import org.springframework.boot.context.properties.ConfigurationProperties; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | import org.springframework.context.annotation.Primary; 9 | 10 | @Configuration(proxyBeanMethods = false) 11 | public class Neo4jPropertiesConfig { 12 | 13 | @Bean 14 | @Primary 15 | @ConfigurationProperties("spring.neo4j") 16 | public Neo4jProperties moviesProperties() { 17 | return new Neo4jProperties(); 18 | } 19 | 20 | @Bean 21 | @Primary 22 | @ConfigurationProperties("spring.data.neo4j") 23 | public Neo4jDataProperties moviesDataProperties() { 24 | return new Neo4jDataProperties(); 25 | } 26 | 27 | @Bean 28 | @ConfigurationProperties("fitness.spring.neo4j") 29 | public Neo4jProperties fitnessProperties() { 30 | return new Neo4jProperties(); 31 | } 32 | 33 | @Bean 34 | @ConfigurationProperties("fitness.spring.data.neo4j") 35 | public Neo4jDataProperties fitnessDataProperties() { 36 | return new Neo4jDataProperties(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /examples/sdn6-multidb-multi-connections-reactive/src/main/java/org/neo4j/tips/sdn/sdn6multidbmulticonnections/Sdn6MultidbMultiConnectionsApplication.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.sdn.sdn6multidbmulticonnections; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Sdn6MultidbMultiConnectionsApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Sdn6MultidbMultiConnectionsApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /examples/sdn6-multidb-multi-connections-reactive/src/main/java/org/neo4j/tips/sdn/sdn6multidbmulticonnections/fitness/Whatever.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.sdn.sdn6multidbmulticonnections.fitness; 2 | 3 | import org.springframework.data.neo4j.core.schema.GeneratedValue; 4 | import org.springframework.data.neo4j.core.schema.Id; 5 | import org.springframework.data.neo4j.core.schema.Node; 6 | import org.springframework.data.neo4j.core.schema.Property; 7 | 8 | @Node 9 | public final class Whatever { 10 | 11 | @Id @GeneratedValue 12 | private Long id; 13 | 14 | @Property("tagline") 15 | private final String description; 16 | 17 | public Whatever(String description) { 18 | this.description = description; 19 | } 20 | 21 | public Long getId() { 22 | return id; 23 | } 24 | 25 | public String getDescription() { 26 | return description; 27 | } 28 | 29 | @Override public String toString() { 30 | return "Whatever{" + 31 | "id=" + id + 32 | ", description='" + description + '\'' + 33 | '}'; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /examples/sdn6-multidb-multi-connections-reactive/src/main/java/org/neo4j/tips/sdn/sdn6multidbmulticonnections/fitness/WhateverRepository.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.sdn.sdn6multidbmulticonnections.fitness; 2 | 3 | import org.springframework.data.neo4j.repository.Neo4jRepository; 4 | import org.springframework.data.neo4j.repository.ReactiveNeo4jRepository; 5 | 6 | public interface WhateverRepository extends ReactiveNeo4jRepository { 7 | } 8 | -------------------------------------------------------------------------------- /examples/sdn6-multidb-multi-connections-reactive/src/main/java/org/neo4j/tips/sdn/sdn6multidbmulticonnections/movies/Movie.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.sdn.sdn6multidbmulticonnections.movies; 2 | 3 | import org.springframework.data.neo4j.core.schema.Id; 4 | import org.springframework.data.neo4j.core.schema.Node; 5 | import org.springframework.data.neo4j.core.schema.Property; 6 | 7 | @Node 8 | public final class Movie { 9 | 10 | @Id 11 | private final String title; 12 | 13 | @Property("tagline") 14 | private final String description; 15 | 16 | public Movie(String title, String description) { 17 | this.title = title; 18 | this.description = description; 19 | } 20 | 21 | public String getTitle() { 22 | return title; 23 | } 24 | 25 | public String getDescription() { 26 | return description; 27 | } 28 | 29 | @Override public String toString() { 30 | return "Movie{" + 31 | "title='" + title + '\'' + 32 | ", description='" + description + '\'' + 33 | '}'; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /examples/sdn6-multidb-multi-connections-reactive/src/main/java/org/neo4j/tips/sdn/sdn6multidbmulticonnections/movies/MovieRepository.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.sdn.sdn6multidbmulticonnections.movies; 2 | 3 | import org.springframework.data.neo4j.repository.ReactiveNeo4jRepository; 4 | 5 | public interface MovieRepository extends ReactiveNeo4jRepository { 6 | } 7 | -------------------------------------------------------------------------------- /examples/sdn6-multidb-multi-connections-reactive/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.neo4j.authentication.username=u_movies 2 | spring.neo4j.authentication.password=p_movies 3 | spring.neo4j.uri=bolt://localhost:7687 4 | spring.data.neo4j.database=movies 5 | 6 | fitness.spring.neo4j.authentication.username=u_fitness 7 | fitness.spring.neo4j.authentication.password=p_fitness 8 | fitness.spring.neo4j.uri=bolt://localhost:7687 9 | fitness.spring.data.neo4j.database=fitness 10 | 11 | management.endpoint.health.show-details=always 12 | 13 | -------------------------------------------------------------------------------- /examples/sdn6-multidb-multi-connections-reactive/src/test/java/org/neo4j/tips/sdn/sdn6multidbmulticonnections/Sdn6MultidbMultiConnectionsApplicationTests.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.sdn.sdn6multidbmulticonnections; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class Sdn6MultidbMultiConnectionsApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /examples/sdn6-multidb-multi-connections/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /examples/sdn6-multidb-multi-connections/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michael-simons/neo4j-examples-and-tips/d1dace775ca88441d6680e2bb3a9c9e11edfa8fc/examples/sdn6-multidb-multi-connections/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /examples/sdn6-multidb-multi-connections/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /examples/sdn6-multidb-multi-connections/src/main/java/org/neo4j/tips/sdn/sdn6multidbmulticonnections/Neo4jPropertiesConfig.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.sdn.sdn6multidbmulticonnections; 2 | 3 | import org.springframework.boot.autoconfigure.data.neo4j.Neo4jDataProperties; 4 | import org.springframework.boot.autoconfigure.neo4j.Neo4jProperties; 5 | import org.springframework.boot.context.properties.ConfigurationProperties; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | import org.springframework.context.annotation.Primary; 9 | 10 | @Configuration(proxyBeanMethods = false) 11 | public class Neo4jPropertiesConfig { 12 | 13 | @Bean 14 | @Primary 15 | @ConfigurationProperties("spring.neo4j") 16 | public Neo4jProperties moviesProperties() { 17 | return new Neo4jProperties(); 18 | } 19 | 20 | @Bean 21 | @Primary 22 | @ConfigurationProperties("spring.data.neo4j") 23 | public Neo4jDataProperties moviesDataProperties() { 24 | return new Neo4jDataProperties(); 25 | } 26 | 27 | @Bean 28 | @ConfigurationProperties("fitness.spring.neo4j") 29 | public Neo4jProperties fitnessProperties() { 30 | return new Neo4jProperties(); 31 | } 32 | 33 | @Bean 34 | @ConfigurationProperties("fitness.spring.data.neo4j") 35 | public Neo4jDataProperties fitnessDataProperties() { 36 | return new Neo4jDataProperties(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /examples/sdn6-multidb-multi-connections/src/main/java/org/neo4j/tips/sdn/sdn6multidbmulticonnections/Sdn6MultidbMultiConnectionsApplication.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.sdn.sdn6multidbmulticonnections; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Sdn6MultidbMultiConnectionsApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Sdn6MultidbMultiConnectionsApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /examples/sdn6-multidb-multi-connections/src/main/java/org/neo4j/tips/sdn/sdn6multidbmulticonnections/fitness/Whatever.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.sdn.sdn6multidbmulticonnections.fitness; 2 | 3 | import org.springframework.data.neo4j.core.schema.GeneratedValue; 4 | import org.springframework.data.neo4j.core.schema.Id; 5 | import org.springframework.data.neo4j.core.schema.Node; 6 | import org.springframework.data.neo4j.core.schema.Property; 7 | 8 | @Node 9 | public final class Whatever { 10 | 11 | @Id @GeneratedValue 12 | private Long id; 13 | 14 | @Property("tagline") 15 | private final String description; 16 | 17 | public Whatever(String description) { 18 | this.description = description; 19 | } 20 | 21 | public Long getId() { 22 | return id; 23 | } 24 | 25 | public String getDescription() { 26 | return description; 27 | } 28 | 29 | @Override public String toString() { 30 | return "Whatever{" + 31 | "id=" + id + 32 | ", description='" + description + '\'' + 33 | '}'; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /examples/sdn6-multidb-multi-connections/src/main/java/org/neo4j/tips/sdn/sdn6multidbmulticonnections/fitness/WhateverRepository.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.sdn.sdn6multidbmulticonnections.fitness; 2 | 3 | import org.springframework.data.neo4j.repository.Neo4jRepository; 4 | 5 | public interface WhateverRepository extends Neo4jRepository { 6 | } 7 | -------------------------------------------------------------------------------- /examples/sdn6-multidb-multi-connections/src/main/java/org/neo4j/tips/sdn/sdn6multidbmulticonnections/health/Neo4jHealthConfig.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.sdn.sdn6multidbmulticonnections.health; 2 | 3 | import java.util.Map; 4 | 5 | import org.springframework.beans.factory.InitializingBean; 6 | import org.springframework.boot.actuate.health.CompositeHealthContributor; 7 | import org.springframework.boot.actuate.health.HealthContributor; 8 | import org.springframework.boot.actuate.health.HealthContributorNameFactory; 9 | import org.springframework.boot.actuate.health.HealthContributorRegistry; 10 | import org.springframework.context.annotation.Bean; 11 | import org.springframework.context.annotation.Configuration; 12 | 13 | @Configuration(proxyBeanMethods = false) 14 | public class Neo4jHealthConfig { 15 | 16 | @Bean 17 | HealthContributor neo4jHealthIndicator( 18 | Map customNeo4jHealthIndicators) { 19 | return CompositeHealthContributor.fromMap(customNeo4jHealthIndicators); 20 | } 21 | 22 | @Bean 23 | InitializingBean healthContributorRegistryCleaner(HealthContributorRegistry healthContributorRegistry, 24 | Map customNeo4jHealthIndicators) { 25 | return () -> customNeo4jHealthIndicators.keySet() 26 | .stream() 27 | .map(HealthContributorNameFactory.INSTANCE) 28 | .forEach(healthContributorRegistry::unregisterContributor); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /examples/sdn6-multidb-multi-connections/src/main/java/org/neo4j/tips/sdn/sdn6multidbmulticonnections/movies/Movie.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.sdn.sdn6multidbmulticonnections.movies; 2 | 3 | import org.springframework.data.neo4j.core.schema.Id; 4 | import org.springframework.data.neo4j.core.schema.Node; 5 | import org.springframework.data.neo4j.core.schema.Property; 6 | 7 | @Node 8 | public final class Movie { 9 | 10 | @Id 11 | private final String title; 12 | 13 | @Property("tagline") 14 | private final String description; 15 | 16 | public Movie(String title, String description) { 17 | this.title = title; 18 | this.description = description; 19 | } 20 | 21 | public String getTitle() { 22 | return title; 23 | } 24 | 25 | public String getDescription() { 26 | return description; 27 | } 28 | 29 | @Override public String toString() { 30 | return "Movie{" + 31 | "title='" + title + '\'' + 32 | ", description='" + description + '\'' + 33 | '}'; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /examples/sdn6-multidb-multi-connections/src/main/java/org/neo4j/tips/sdn/sdn6multidbmulticonnections/movies/MovieRepository.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.sdn.sdn6multidbmulticonnections.movies; 2 | 3 | import org.springframework.data.neo4j.repository.Neo4jRepository; 4 | 5 | public interface MovieRepository extends Neo4jRepository { 6 | } 7 | -------------------------------------------------------------------------------- /examples/sdn6-multidb-multi-connections/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.neo4j.authentication.username=u_movies 2 | spring.neo4j.authentication.password=p_movies 3 | spring.neo4j.uri=bolt://localhost:7687 4 | spring.data.neo4j.database=movies 5 | 6 | fitness.spring.neo4j.authentication.username=u_fitness 7 | fitness.spring.neo4j.authentication.password=p_fitness 8 | fitness.spring.neo4j.uri=bolt://localhost:7687 9 | fitness.spring.data.neo4j.database=fitness 10 | 11 | management.endpoint.health.show-details=always 12 | -------------------------------------------------------------------------------- /examples/sdn6-multidb-multi-connections/src/test/java/org/neo4j/tips/sdn/sdn6multidbmulticonnections/Sdn6MultidbMultiConnectionsApplicationTests.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.sdn.sdn6multidbmulticonnections; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class Sdn6MultidbMultiConnectionsApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /examples/sdn6-on-helidon/.dockerignore: -------------------------------------------------------------------------------- 1 | target/* -------------------------------------------------------------------------------- /examples/sdn6-on-helidon/Dockerfile: -------------------------------------------------------------------------------- 1 | 2 | # 1st stage, build the app 3 | FROM maven:3.6-jdk-11 as build 4 | 5 | WORKDIR /helidon 6 | 7 | # Create a first layer to cache the "Maven World" in the local repository. 8 | # Incremental docker builds will always resume after that, unless you update 9 | # the pom 10 | ADD pom.xml . 11 | RUN mvn package -Dmaven.test.skip -Declipselink.weave.skip 12 | 13 | # Do the Maven build! 14 | # Incremental docker builds will resume here when you change sources 15 | ADD src src 16 | RUN mvn package -DskipTests 17 | RUN echo "done!" 18 | 19 | # 2nd stage, build the runtime image 20 | FROM openjdk:11-jre-slim 21 | WORKDIR /helidon 22 | 23 | # Copy the binary built in the 1st stage 24 | COPY --from=build /helidon/target/helidon-quickstart-mp.jar ./ 25 | COPY --from=build /helidon/target/libs ./libs 26 | 27 | CMD ["java", "-jar", "helidon-quickstart-mp.jar"] 28 | 29 | EXPOSE 8080 30 | -------------------------------------------------------------------------------- /examples/sdn6-on-helidon/Dockerfile.jlink: -------------------------------------------------------------------------------- 1 | 2 | # 1st stage, build the app 3 | FROM maven:3.6.3-jdk-11-slim as build 4 | 5 | WORKDIR /helidon 6 | 7 | # Create a first layer to cache the "Maven World" in the local repository. 8 | # Incremental docker builds will always resume after that, unless you update 9 | # the pom 10 | ADD pom.xml . 11 | RUN mvn package -Dmaven.test.skip -Declipselink.weave.skip 12 | 13 | # Do the Maven build to create the custom Java Runtime Image 14 | # Incremental docker builds will resume here when you change sources 15 | ADD src src 16 | RUN mvn -Ddocker.build=true package -Pjlink-image -DskipTests 17 | RUN echo "done!" 18 | 19 | # 2nd stage, build the final image with the JRI built in the 1st stage 20 | 21 | FROM debian:stretch-slim 22 | WORKDIR /helidon 23 | COPY --from=build /helidon/target/helidon-quickstart-mp ./ 24 | ENTRYPOINT ["/bin/bash", "/helidon/bin/start"] 25 | EXPOSE 8080 26 | -------------------------------------------------------------------------------- /examples/sdn6-on-helidon/Dockerfile.native: -------------------------------------------------------------------------------- 1 | 2 | # 1st stage, build the app 3 | FROM helidon/jdk11-graalvm-maven:20.1.0 as build 4 | 5 | WORKDIR /helidon 6 | 7 | # Create a first layer to cache the "Maven World" in the local repository. 8 | # Incremental docker builds will always resume after that, unless you update 9 | # the pom 10 | ADD pom.xml . 11 | RUN mvn package -Pnative-image -Dnative.image.skip -Dmaven.test.skip -Declipselink.weave.skip 12 | 13 | # Do the Maven build! 14 | # Incremental docker builds will resume here when you change sources 15 | ADD src src 16 | RUN mvn package -Pnative-image -Dnative.image.buildStatic -DskipTests 17 | 18 | RUN echo "done!" 19 | 20 | # 2nd stage, build the runtime image 21 | FROM scratch 22 | WORKDIR /helidon 23 | 24 | # Copy the binary built in the 1st stage 25 | COPY --from=build /helidon/target/helidon-quickstart-mp . 26 | 27 | ENTRYPOINT ["./helidon-quickstart-mp"] 28 | 29 | EXPOSE 8080 30 | -------------------------------------------------------------------------------- /examples/sdn6-on-helidon/src/main/java/io/helidon/examples/quickstart/mp/GreetingProvider.java: -------------------------------------------------------------------------------- 1 | 2 | package io.helidon.examples.quickstart.mp; 3 | 4 | import java.util.concurrent.atomic.AtomicReference; 5 | 6 | import javax.enterprise.context.ApplicationScoped; 7 | import javax.inject.Inject; 8 | 9 | import org.eclipse.microprofile.config.inject.ConfigProperty; 10 | 11 | /** 12 | * Provider for greeting message. 13 | */ 14 | @ApplicationScoped 15 | public class GreetingProvider { 16 | private final AtomicReference message = new AtomicReference<>(); 17 | 18 | /** 19 | * Create a new greeting provider, reading the message from configuration. 20 | * 21 | * @param message greeting to use 22 | */ 23 | @Inject 24 | public GreetingProvider(@ConfigProperty(name = "app.greeting") String message) { 25 | this.message.set(message); 26 | } 27 | 28 | String getMessage() { 29 | return message.get(); 30 | } 31 | 32 | void setMessage(String message) { 33 | this.message.set(message); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /examples/sdn6-on-helidon/src/main/java/io/helidon/examples/quickstart/mp/Neo4jConfig.java: -------------------------------------------------------------------------------- 1 | package io.helidon.examples.quickstart.mp; 2 | 3 | import java.util.logging.Level; 4 | 5 | import javax.enterprise.context.ApplicationScoped; 6 | import javax.enterprise.inject.Disposes; 7 | import javax.enterprise.inject.Produces; 8 | 9 | import org.eclipse.microprofile.config.inject.ConfigProperty; 10 | import org.neo4j.driver.AuthTokens; 11 | import org.neo4j.driver.Config; 12 | import org.neo4j.driver.Driver; 13 | import org.neo4j.driver.GraphDatabase; 14 | import org.neo4j.driver.Logging; 15 | 16 | /** 17 | * This is what I expect helidon to do for me based on properties. 18 | */ 19 | public class Neo4jConfig { 20 | 21 | @Produces 22 | @ApplicationScoped 23 | public Driver driver( 24 | @ConfigProperty(name = "neo4j.uri") String url, 25 | @ConfigProperty(name = "neo4j.authentication.username") String username, 26 | @ConfigProperty(name = "neo4j.authentication.password") String password 27 | ) { 28 | return GraphDatabase 29 | .driver(url, AuthTokens.basic(username, password), Config.builder().withLogging( 30 | Logging.javaUtilLogging(Level.INFO)).build()); 31 | } 32 | 33 | public void close(@Disposes Driver driver) { 34 | driver.close(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /examples/sdn6-on-helidon/src/main/java/io/helidon/examples/quickstart/mp/api/MovieResource.java: -------------------------------------------------------------------------------- 1 | package io.helidon.examples.quickstart.mp.api; 2 | 3 | import io.helidon.examples.quickstart.mp.domain.Movie; 4 | import io.helidon.examples.quickstart.mp.domain.MovieRepository; 5 | 6 | import javax.enterprise.context.RequestScoped; 7 | import javax.inject.Inject; 8 | import javax.ws.rs.GET; 9 | import javax.ws.rs.Path; 10 | import javax.ws.rs.Produces; 11 | import javax.ws.rs.core.MediaType; 12 | 13 | @RequestScoped 14 | @Path("/api/movies") 15 | public class MovieResource { 16 | 17 | @Inject 18 | MovieRepository movieRepository; 19 | 20 | @GET 21 | @Path("/") 22 | @Produces(MediaType.APPLICATION_JSON) 23 | public Iterable getMovies() { 24 | 25 | return movieRepository.findAll(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /examples/sdn6-on-helidon/src/main/java/io/helidon/examples/quickstart/mp/domain/Actor.java: -------------------------------------------------------------------------------- 1 | package io.helidon.examples.quickstart.mp.domain; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import org.springframework.data.neo4j.core.schema.RelationshipProperties; 7 | import org.springframework.data.neo4j.core.schema.TargetNode; 8 | 9 | /** 10 | * @author Michael J. Simons 11 | */ 12 | @RelationshipProperties 13 | public class Actor { 14 | 15 | @TargetNode 16 | private final Person person; 17 | 18 | private List roles = new ArrayList<>(); 19 | 20 | public Actor(Person person) { 21 | this.person = person; 22 | } 23 | 24 | public List getRoles() { 25 | return roles; 26 | } 27 | 28 | public void setRoles(List roles) { 29 | this.roles = roles; 30 | } 31 | 32 | public Person getPerson() { 33 | return person; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /examples/sdn6-on-helidon/src/main/java/io/helidon/examples/quickstart/mp/domain/MovieRepository.java: -------------------------------------------------------------------------------- 1 | package io.helidon.examples.quickstart.mp.domain; 2 | 3 | import javax.enterprise.context.ApplicationScoped; 4 | 5 | import org.springframework.data.neo4j.repository.Neo4jRepository; 6 | 7 | @ApplicationScoped 8 | // IDEA yells here as the repo is an interface and without annotation it is not included in the Jandex file 9 | public interface MovieRepository extends Neo4jRepository { 10 | } 11 | -------------------------------------------------------------------------------- /examples/sdn6-on-helidon/src/main/java/io/helidon/examples/quickstart/mp/domain/Person.java: -------------------------------------------------------------------------------- 1 | package io.helidon.examples.quickstart.mp.domain; 2 | 3 | import org.springframework.data.neo4j.core.schema.Id; 4 | import org.springframework.data.neo4j.core.schema.Node; 5 | 6 | /** 7 | * @author Mark Angrish 8 | * @author Michael J. Simons 9 | */ 10 | @Node 11 | public class Person { 12 | 13 | @Id 14 | private final String name; 15 | 16 | private Integer born; 17 | 18 | public Person(Integer born, String name) { 19 | this.born = born; 20 | this.name = name; 21 | } 22 | 23 | public String getName() { 24 | return name; 25 | } 26 | 27 | public Integer getBorn() { 28 | return born; 29 | } 30 | 31 | public void setBorn(Integer born) { 32 | this.born = born; 33 | } 34 | 35 | @Override 36 | public String toString() { 37 | return "Person{" + 38 | "name='" + name + '\'' + 39 | ", born=" + born + 40 | '}'; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /examples/sdn6-on-helidon/src/main/java/io/helidon/examples/quickstart/mp/package-info.java: -------------------------------------------------------------------------------- 1 | 2 | package io.helidon.examples.quickstart.mp; 3 | -------------------------------------------------------------------------------- /examples/sdn6-on-helidon/src/main/resources/META-INF/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | -------------------------------------------------------------------------------- /examples/sdn6-on-helidon/src/main/resources/META-INF/microprofile-config.properties: -------------------------------------------------------------------------------- 1 | 2 | # Application properties. This is the default greeting 3 | app.greeting=Hello 4 | 5 | # Microprofile server properties 6 | server.port=8080 7 | server.host=0.0.0.0 8 | 9 | # Turn on support for REST.request SimpleTimers for all JAX-RS endpoints 10 | metrics.rest-request.enabled=true 11 | 12 | neo4j.uri = bolt://localhost:7687 13 | neo4j.authentication.username = neo4j 14 | neo4j.authentication.password = secret 15 | -------------------------------------------------------------------------------- /examples/sdn6-on-helidon/src/main/resources/META-INF/native-image/reflect-config.json: -------------------------------------------------------------------------------- 1 | [] 2 | -------------------------------------------------------------------------------- /examples/sdn6-on-helidon/src/main/resources/logging.properties: -------------------------------------------------------------------------------- 1 | 2 | # Example Logging Configuration File 3 | # For more information see $JAVA_HOME/jre/lib/logging.properties 4 | 5 | # Send messages to the console 6 | handlers=io.helidon.common.HelidonConsoleHandler 7 | 8 | # HelidonConsoleHandler uses a SimpleFormatter subclass that replaces "!thread!" with the current thread 9 | java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$s %3$s !thread!: %5$s%6$s%n 10 | 11 | # Global logging level. Can be overridden by specific loggers 12 | .level=INFO 13 | 14 | # Component specific log levels 15 | #io.helidon.webserver.level=INFO 16 | #io.helidon.config.level=INFO 17 | #io.helidon.security.level=INFO 18 | #io.helidon.common.level=INFO 19 | #io.netty.level=INFO 20 | -------------------------------------------------------------------------------- /examples/sdn6-on-liberty/src/main/java/ac/simons/neo4j/sdn_on_liberty/GraphApplication.java: -------------------------------------------------------------------------------- 1 | package ac.simons.neo4j.sdn_on_liberty; 2 | 3 | import javax.ws.rs.ApplicationPath; 4 | import javax.ws.rs.core.Application; 5 | 6 | @ApplicationPath("/api") 7 | public class GraphApplication extends Application { 8 | } 9 | -------------------------------------------------------------------------------- /examples/sdn6-on-liberty/src/main/java/ac/simons/neo4j/sdn_on_liberty/Neo4jConfig.java: -------------------------------------------------------------------------------- 1 | package ac.simons.neo4j.sdn_on_liberty; 2 | 3 | import javax.enterprise.context.ApplicationScoped; 4 | import javax.enterprise.inject.Disposes; 5 | import javax.enterprise.inject.Produces; 6 | 7 | import org.neo4j.driver.AuthTokens; 8 | import org.neo4j.driver.Config; 9 | import org.neo4j.driver.Driver; 10 | import org.neo4j.driver.GraphDatabase; 11 | import org.neo4j.driver.Logging; 12 | 13 | public class Neo4jConfig { 14 | 15 | @Produces 16 | @ApplicationScoped 17 | public Driver driver() { 18 | return GraphDatabase 19 | .driver("bolt://localhost:7687", AuthTokens.basic("neo4j", "secret"), Config.builder().withLogging( 20 | Logging.slf4j()).build()); 21 | } 22 | 23 | public void close(@Disposes Driver driver) { 24 | driver.close(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /examples/sdn6-on-liberty/src/main/java/ac/simons/neo4j/sdn_on_liberty/api/MovieResource.java: -------------------------------------------------------------------------------- 1 | package ac.simons.neo4j.sdn_on_liberty.api; 2 | 3 | import ac.simons.neo4j.sdn_on_liberty.domain.Movie; 4 | import ac.simons.neo4j.sdn_on_liberty.domain.MovieRepository; 5 | 6 | import javax.enterprise.context.RequestScoped; 7 | import javax.inject.Inject; 8 | import javax.ws.rs.GET; 9 | import javax.ws.rs.Path; 10 | import javax.ws.rs.Produces; 11 | import javax.ws.rs.core.MediaType; 12 | 13 | @RequestScoped 14 | @Path("movies") 15 | public class MovieResource { 16 | 17 | @Inject 18 | MovieRepository movieRepository; 19 | 20 | @GET 21 | @Path("/") 22 | @Produces(MediaType.APPLICATION_JSON) 23 | public Iterable getMovies() { 24 | 25 | return movieRepository.findAll(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /examples/sdn6-on-liberty/src/main/java/ac/simons/neo4j/sdn_on_liberty/domain/Actor.java: -------------------------------------------------------------------------------- 1 | package ac.simons.neo4j.sdn_on_liberty.domain; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import org.springframework.data.neo4j.core.schema.RelationshipProperties; 7 | import org.springframework.data.neo4j.core.schema.TargetNode; 8 | 9 | /** 10 | * @author Michael J. Simons 11 | */ 12 | @RelationshipProperties 13 | public class Actor { 14 | 15 | @TargetNode 16 | private final Person person; 17 | 18 | private List roles = new ArrayList<>(); 19 | 20 | public Actor(Person person) { 21 | this.person = person; 22 | } 23 | 24 | public List getRoles() { 25 | return roles; 26 | } 27 | 28 | public void setRoles(List roles) { 29 | this.roles = roles; 30 | } 31 | 32 | public Person getPerson() { 33 | return person; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /examples/sdn6-on-liberty/src/main/java/ac/simons/neo4j/sdn_on_liberty/domain/MovieRepository.java: -------------------------------------------------------------------------------- 1 | package ac.simons.neo4j.sdn_on_liberty.domain; 2 | 3 | import org.springframework.data.neo4j.repository.Neo4jRepository; 4 | 5 | public interface MovieRepository extends Neo4jRepository { 6 | } 7 | -------------------------------------------------------------------------------- /examples/sdn6-on-liberty/src/main/java/ac/simons/neo4j/sdn_on_liberty/domain/Person.java: -------------------------------------------------------------------------------- 1 | package ac.simons.neo4j.sdn_on_liberty.domain; 2 | 3 | import org.springframework.data.neo4j.core.schema.Id; 4 | import org.springframework.data.neo4j.core.schema.Node; 5 | 6 | /** 7 | * @author Mark Angrish 8 | * @author Michael J. Simons 9 | */ 10 | @Node 11 | public class Person { 12 | 13 | @Id 14 | private final String name; 15 | 16 | private Integer born; 17 | 18 | public Person(Integer born, String name) { 19 | this.born = born; 20 | this.name = name; 21 | } 22 | 23 | public String getName() { 24 | return name; 25 | } 26 | 27 | public Integer getBorn() { 28 | return born; 29 | } 30 | 31 | public void setBorn(Integer born) { 32 | this.born = born; 33 | } 34 | 35 | @Override 36 | public String toString() { 37 | return "Person{" + 38 | "name='" + name + '\'' + 39 | ", born=" + born + 40 | '}'; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /examples/sdn6-on-liberty/src/main/java/ac/simons/neo4j/sdn_on_liberty/domain/Roles.java: -------------------------------------------------------------------------------- 1 | package ac.simons.neo4j.sdn_on_liberty.domain; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.data.neo4j.core.schema.RelationshipProperties; 6 | 7 | @RelationshipProperties 8 | public class Roles { 9 | 10 | private final List roles; 11 | 12 | public Roles(List roles) { 13 | this.roles = roles; 14 | } 15 | 16 | public List getRoles() { 17 | return roles; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /examples/sdn6-on-liberty/src/main/liberty/config/server.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | servlet-4.0 5 | cdi-2.0 6 | jaxrs-2.1 7 | 8 | 9 | 10 | 11 | 12 | 14 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /examples/sdn6-on-liberty/src/main/resources/META-INF/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | -------------------------------------------------------------------------------- /examples/sdn6-rest/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /examples/sdn6-rest/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michael-simons/neo4j-examples-and-tips/d1dace775ca88441d6680e2bb3a9c9e11edfa8fc/examples/sdn6-rest/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /examples/sdn6-rest/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar 3 | -------------------------------------------------------------------------------- /examples/sdn6-rest/src/main/java/org/neo4j/tips/sdn/sdn6_rest/Application.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.sdn.sdn6_rest; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Application { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Application.class, args); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /examples/sdn6-rest/src/main/java/org/neo4j/tips/sdn/sdn6_rest/movies/Actor.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.sdn.sdn6_rest.movies; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import org.springframework.data.neo4j.core.schema.GeneratedValue; 7 | import org.springframework.data.neo4j.core.schema.Id; 8 | import org.springframework.data.neo4j.core.schema.RelationshipProperties; 9 | import org.springframework.data.neo4j.core.schema.TargetNode; 10 | 11 | import com.fasterxml.jackson.annotation.JsonIgnore; 12 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 13 | import com.fasterxml.jackson.annotation.JsonUnwrapped; 14 | 15 | @RelationshipProperties 16 | public final class Actor { 17 | 18 | @Id @GeneratedValue @JsonIgnore 19 | private Long id; 20 | 21 | @TargetNode 22 | @JsonIgnore 23 | private final Person person; 24 | 25 | private final List roles; 26 | 27 | public Actor(Person person, List roles) { 28 | this.person = person; 29 | this.roles = new ArrayList<>(roles); 30 | } 31 | 32 | public Person getPerson() { 33 | return person; 34 | } 35 | 36 | public List getRoles() { 37 | return List.copyOf(roles); 38 | } 39 | } 40 | 41 | 42 | -------------------------------------------------------------------------------- /examples/sdn6-rest/src/main/java/org/neo4j/tips/sdn/sdn6_rest/movies/MovieRepository.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.sdn.sdn6_rest.movies; 2 | 3 | import org.springframework.data.neo4j.repository.Neo4jRepository; 4 | 5 | public interface MovieRepository extends Neo4jRepository { 6 | } 7 | -------------------------------------------------------------------------------- /examples/sdn6-rest/src/main/java/org/neo4j/tips/sdn/sdn6_rest/movies/PeopleRepository.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.sdn.sdn6_rest.movies; 2 | 3 | import java.util.Optional; 4 | import java.util.UUID; 5 | 6 | import org.springframework.data.neo4j.repository.Neo4jRepository; 7 | import org.springframework.data.neo4j.repository.query.Query; 8 | import org.springframework.data.rest.core.annotation.RepositoryRestResource; 9 | import org.springframework.data.rest.core.annotation.RestResource; 10 | 11 | /** 12 | * @author Michael J. Simons 13 | */ 14 | @RepositoryRestResource(path = "people") 15 | public interface PeopleRepository extends Neo4jRepository { 16 | 17 | @Query(""" 18 | MATCH (person:Person {name: $name}) 19 | OPTIONAL MATCH (person)-[:DIRECTED]->(d:Movie) 20 | OPTIONAL MATCH (person)<-[r:ACTED_IN]->(a:Movie) 21 | OPTIONAL MATCH (person)-->(movies)<-[relatedRole:ACTED_IN]-(relatedPerson) 22 | RETURN DISTINCT person, 23 | collect(DISTINCT d) AS directed, 24 | collect(DISTINCT a) AS actedIn, 25 | collect(DISTINCT relatedPerson) AS related 26 | """) 27 | Optional getDetailsByName(String name); 28 | } 29 | -------------------------------------------------------------------------------- /examples/sdn6-rest/src/main/java/org/neo4j/tips/sdn/sdn6_rest/movies/Person.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.sdn.sdn6_rest.movies; 2 | 3 | import java.util.UUID; 4 | 5 | import org.springframework.data.annotation.PersistenceConstructor; 6 | import org.springframework.data.neo4j.core.schema.GeneratedValue; 7 | import org.springframework.data.neo4j.core.schema.Id; 8 | import org.springframework.data.neo4j.core.schema.Node; 9 | 10 | import com.fasterxml.jackson.annotation.JsonCreator; 11 | 12 | @Node 13 | public final class Person { 14 | 15 | @Id @GeneratedValue 16 | private final UUID id; 17 | 18 | private final String name; 19 | 20 | private Integer born; 21 | 22 | @PersistenceConstructor 23 | private Person(UUID id, String name, Integer born) { 24 | this.id = id; 25 | this.born = born; 26 | this.name = name; 27 | } 28 | 29 | @JsonCreator 30 | public Person(String name, Integer born) { 31 | this(null, name, born); 32 | } 33 | 34 | public UUID getId() { 35 | return id; 36 | } 37 | 38 | public String getName() { 39 | return name; 40 | } 41 | 42 | public Integer getBorn() { 43 | return born; 44 | } 45 | 46 | public void setBorn(Integer born) { 47 | this.born = born; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /examples/sdn6-rest/src/main/java/org/neo4j/tips/sdn/sdn6_rest/movies/PersonDetails.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.sdn.sdn6_rest.movies; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | /** 7 | * This is a DTO based projection, containing a couple of additional details, 8 | * like the list of movies a person acted in, the movies they direct and which other 9 | * people they acted with 10 | */ 11 | public final class PersonDetails { 12 | 13 | private final String name; 14 | 15 | private final Integer born; 16 | 17 | private final List actedIn; 18 | 19 | private final List directed; 20 | 21 | private final List related; 22 | 23 | public PersonDetails(String name, Integer born, List actedIn, 24 | List directed, List related) { 25 | this.name = name; 26 | this.born = born; 27 | this.actedIn = new ArrayList<>(actedIn); 28 | this.directed = new ArrayList<>(directed); 29 | this.related = new ArrayList<>(related); 30 | } 31 | 32 | public String getName() { 33 | return name; 34 | } 35 | 36 | public Integer getBorn() { 37 | return born; 38 | } 39 | 40 | public List getActedIn() { 41 | return List.copyOf(actedIn); 42 | } 43 | 44 | public List getDirected() { 45 | return List.copyOf(directed); 46 | } 47 | 48 | public List getRelated() { 49 | return List.copyOf(related); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /examples/sdn6-rest/src/main/resources/neo4j/migrations/V0001__Remove_old_indexes.cypher: -------------------------------------------------------------------------------- 1 | DROP CONSTRAINT title_unique IF EXISTS; 2 | -------------------------------------------------------------------------------- /examples/sdn6-rest/src/main/resources/neo4j/migrations/V0002__Create_movie_title_index.cypher: -------------------------------------------------------------------------------- 1 | CREATE INDEX movie_title_index IF NOT EXISTS FOR (n:Movie) ON (n.title); 2 | -------------------------------------------------------------------------------- /examples/sdn6-rest/src/main/resources/neo4j/migrations/V0003__Create_person_name_index.cypher: -------------------------------------------------------------------------------- 1 | CREATE INDEX person_name_index IF NOT EXISTS FOR (n:Person) ON (n.name); 2 | -------------------------------------------------------------------------------- /examples/sdn6-rest/src/main/resources/neo4j/migrations/V0004__Create_person_id_constraint.cypher: -------------------------------------------------------------------------------- 1 | CREATE CONSTRAINT person_id_uk IF NOT EXISTS FOR (p:Person) REQUIRE p.id IS UNIQUE; 2 | -------------------------------------------------------------------------------- /examples/sdn6-rest/src/test/resources/example-data/beforeMigrate__clean_database.cypher: -------------------------------------------------------------------------------- 1 | MATCH (n:Movie) DETACH DELETE n; 2 | -------------------------------------------------------------------------------- /examples/sdn6-rest/src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /examples/sdn6/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /examples/sdn6/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michael-simons/neo4j-examples-and-tips/d1dace775ca88441d6680e2bb3a9c9e11edfa8fc/examples/sdn6/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /examples/sdn6/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar 3 | -------------------------------------------------------------------------------- /examples/sdn6/src/main/java/org/neo4j/tips/sdn/sdn6/Application.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.sdn.sdn6; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Application { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Application.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /examples/sdn6/src/main/java/org/neo4j/tips/sdn/sdn6/movies/Actor.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.sdn.sdn6.movies; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import org.springframework.data.neo4j.core.schema.GeneratedValue; 7 | import org.springframework.data.neo4j.core.schema.Id; 8 | import org.springframework.data.neo4j.core.schema.RelationshipProperties; 9 | import org.springframework.data.neo4j.core.schema.TargetNode; 10 | 11 | import com.fasterxml.jackson.annotation.JsonIgnore; 12 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 13 | import com.fasterxml.jackson.annotation.JsonUnwrapped; 14 | 15 | @RelationshipProperties 16 | public final class Actor { 17 | 18 | @Id @GeneratedValue @JsonIgnore 19 | private Long id; 20 | 21 | @TargetNode 22 | @JsonUnwrapped 23 | @JsonIgnoreProperties({ "id" }) 24 | private final Person person; 25 | 26 | private final List roles; 27 | 28 | public Actor(Person person, List roles) { 29 | this.person = person; 30 | this.roles = new ArrayList<>(roles); 31 | } 32 | 33 | public Person getPerson() { 34 | return person; 35 | } 36 | 37 | public List getRoles() { 38 | return List.copyOf(roles); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /examples/sdn6/src/main/java/org/neo4j/tips/sdn/sdn6/movies/MovieRepository.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.sdn.sdn6.movies; 2 | 3 | import org.springframework.data.neo4j.repository.Neo4jRepository; 4 | 5 | interface MovieRepository extends Neo4jRepository { 6 | } 7 | -------------------------------------------------------------------------------- /examples/sdn6/src/main/java/org/neo4j/tips/sdn/sdn6/movies/MoviesController.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.sdn.sdn6.movies; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.data.domain.Sort; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.RestController; 9 | 10 | @RestController 11 | @RequestMapping("/api/movies") 12 | public final class MoviesController { 13 | 14 | private final MovieRepository movieRepository; 15 | 16 | MoviesController(MovieRepository movieRepository) { 17 | this.movieRepository = movieRepository; 18 | } 19 | 20 | @GetMapping({ "", "/" }) 21 | public List get() { 22 | return movieRepository.findAll(Sort.by("title").ascending()); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /examples/sdn6/src/main/java/org/neo4j/tips/sdn/sdn6/movies/PeopleController.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.sdn.sdn6.movies; 2 | 3 | import org.springframework.http.HttpStatus; 4 | import org.springframework.web.bind.annotation.PostMapping; 5 | import org.springframework.web.bind.annotation.RequestBody; 6 | import org.springframework.web.bind.annotation.RequestMapping; 7 | import org.springframework.web.bind.annotation.ResponseStatus; 8 | import org.springframework.web.bind.annotation.RestController; 9 | 10 | @RestController 11 | @RequestMapping("/api/people") 12 | public class PeopleController { 13 | 14 | private final PeopleRepository peopleRepository; 15 | 16 | public PeopleController(PeopleRepository peopleRepository) { 17 | this.peopleRepository = peopleRepository; 18 | } 19 | 20 | @PostMapping 21 | @ResponseStatus(value = HttpStatus.CREATED) 22 | Person createNewPerson(@RequestBody Person person) { 23 | 24 | return peopleRepository.save(person); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /examples/sdn6/src/main/java/org/neo4j/tips/sdn/sdn6/movies/PeopleRepository.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.sdn.sdn6.movies; 2 | 3 | import java.util.Optional; 4 | import java.util.UUID; 5 | 6 | import org.springframework.data.neo4j.repository.Neo4jRepository; 7 | import org.springframework.data.neo4j.repository.query.Query; 8 | 9 | /** 10 | * @author Michael J. Simons 11 | */ 12 | interface PeopleRepository extends Neo4jRepository { 13 | 14 | @Query(""" 15 | MATCH (person:Person {name: $name}) 16 | OPTIONAL MATCH (person)-[:DIRECTED]->(d:Movie) 17 | OPTIONAL MATCH (person)<-[r:ACTED_IN]->(a:Movie) 18 | OPTIONAL MATCH (person)-->(movies)<-[relatedRole:ACTED_IN]-(relatedPerson) 19 | RETURN DISTINCT person, 20 | collect(DISTINCT d) AS directed, 21 | collect(DISTINCT a) AS actedIn, 22 | collect(DISTINCT relatedPerson) AS related 23 | """) 24 | Optional getDetailsByName(String name); 25 | } 26 | -------------------------------------------------------------------------------- /examples/sdn6/src/main/java/org/neo4j/tips/sdn/sdn6/movies/Person.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.sdn.sdn6.movies; 2 | 3 | import java.util.UUID; 4 | 5 | import org.springframework.data.annotation.PersistenceConstructor; 6 | import org.springframework.data.neo4j.core.schema.GeneratedValue; 7 | import org.springframework.data.neo4j.core.schema.Id; 8 | import org.springframework.data.neo4j.core.schema.Node; 9 | 10 | import com.fasterxml.jackson.annotation.JsonCreator; 11 | 12 | @Node 13 | public final class Person { 14 | 15 | @Id @GeneratedValue 16 | private final UUID id; 17 | 18 | private final String name; 19 | 20 | private Integer born; 21 | 22 | @PersistenceConstructor 23 | private Person(UUID id, String name, Integer born) { 24 | this.id = id; 25 | this.born = born; 26 | this.name = name; 27 | } 28 | 29 | @JsonCreator 30 | public Person(String name, Integer born) { 31 | this(null, name, born); 32 | } 33 | 34 | public UUID getId() { 35 | return id; 36 | } 37 | 38 | public String getName() { 39 | return name; 40 | } 41 | 42 | public Integer getBorn() { 43 | return born; 44 | } 45 | 46 | public void setBorn(Integer born) { 47 | this.born = born; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /examples/sdn6/src/main/java/org/neo4j/tips/sdn/sdn6/movies/PersonDetails.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.sdn.sdn6.movies; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | /** 7 | * This is a DTO based projection, containing a couple of additional details, 8 | * like the list of movies a person acted in, the movies they direct and which other 9 | * people they acted with 10 | */ 11 | public final class PersonDetails { 12 | 13 | private final String name; 14 | 15 | private final Integer born; 16 | 17 | private final List actedIn; 18 | 19 | private final List directed; 20 | 21 | private final List related; 22 | 23 | public PersonDetails(String name, Integer born, List actedIn, 24 | List directed, List related) { 25 | this.name = name; 26 | this.born = born; 27 | this.actedIn = new ArrayList<>(actedIn); 28 | this.directed = new ArrayList<>(directed); 29 | this.related = new ArrayList<>(related); 30 | } 31 | 32 | public String getName() { 33 | return name; 34 | } 35 | 36 | public Integer getBorn() { 37 | return born; 38 | } 39 | 40 | public List getActedIn() { 41 | return List.copyOf(actedIn); 42 | } 43 | 44 | public List getDirected() { 45 | return List.copyOf(directed); 46 | } 47 | 48 | public List getRelated() { 49 | return List.copyOf(related); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /examples/sdn6/src/main/resources/neo4j/migrations/V0001__Remove_old_indexes.cypher: -------------------------------------------------------------------------------- 1 | DROP CONSTRAINT title_unique IF EXISTS; 2 | -------------------------------------------------------------------------------- /examples/sdn6/src/main/resources/neo4j/migrations/V0002__Create_movie_title_index.cypher: -------------------------------------------------------------------------------- 1 | CREATE INDEX movie_title_index IF NOT EXISTS FOR (n:Movie) ON (n.title); 2 | -------------------------------------------------------------------------------- /examples/sdn6/src/main/resources/neo4j/migrations/V0003__Create_person_name_index.cypher: -------------------------------------------------------------------------------- 1 | CREATE INDEX person_name_index IF NOT EXISTS FOR (n:Person) ON (n.name); 2 | -------------------------------------------------------------------------------- /examples/sdn6/src/main/resources/neo4j/migrations/V0004__Create_person_id_constraint.cypher: -------------------------------------------------------------------------------- 1 | CREATE CONSTRAINT person_id_uk IF NOT EXISTS FOR (p:Person) REQUIRE p.id IS UNIQUE; 2 | -------------------------------------------------------------------------------- /examples/sdn6/src/test/resources/example-data/beforeMigrate__clean_database.cypher: -------------------------------------------------------------------------------- 1 | MATCH (n:Movie) DETACH DELETE n; 2 | -------------------------------------------------------------------------------- /examples/sdn6/src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /examples/simple-quarkus/.dockerignore: -------------------------------------------------------------------------------- 1 | * 2 | !target/*-runner 3 | !target/*-runner.jar 4 | !target/lib/* 5 | !target/quarkus-app/* -------------------------------------------------------------------------------- /examples/simple-quarkus/.gitignore: -------------------------------------------------------------------------------- 1 | # Eclipse 2 | .project 3 | .classpath 4 | .settings/ 5 | bin/ 6 | 7 | # IntelliJ 8 | .idea 9 | *.ipr 10 | *.iml 11 | *.iws 12 | 13 | # NetBeans 14 | nb-configuration.xml 15 | 16 | # Visual Studio Code 17 | .vscode 18 | .factorypath 19 | 20 | # OSX 21 | .DS_Store 22 | 23 | # Vim 24 | *.swp 25 | *.swo 26 | 27 | # patch 28 | *.orig 29 | *.rej 30 | 31 | # Maven 32 | target/ 33 | pom.xml.tag 34 | pom.xml.releaseBackup 35 | pom.xml.versionsBackup 36 | release.properties -------------------------------------------------------------------------------- /examples/simple-quarkus/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michael-simons/neo4j-examples-and-tips/d1dace775ca88441d6680e2bb3a9c9e11edfa8fc/examples/simple-quarkus/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /examples/simple-quarkus/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /examples/simple-quarkus/README.md: -------------------------------------------------------------------------------- 1 | # simple-quarkus project 2 | 3 | This project uses Quarkus, the Supersonic Subatomic Java Framework. 4 | 5 | If you want to learn more about Quarkus, please visit its website: https://quarkus.io/ . 6 | 7 | ## Running the application in dev mode 8 | 9 | You can run your application in dev mode that enables live coding using: 10 | ``` 11 | ./mvnw quarkus:dev 12 | ``` 13 | 14 | ## Packaging and running the application 15 | 16 | The application can be packaged using `./mvnw package`. 17 | It produces the `simple-quarkus-1.0-SNAPSHOT-runner.jar` file in the `/target` directory. 18 | Be aware that it’s not an _über-jar_ as the dependencies are copied into the `target/lib` directory. 19 | 20 | The application is now runnable using `java -jar target/simple-quarkus-1.0-SNAPSHOT-runner.jar`. 21 | 22 | ## Creating a native executable 23 | 24 | You can create a native executable using: `./mvnw package -Pnative`. 25 | 26 | Or, if you don't have GraalVM installed, you can run the native executable build in a container using: `./mvnw package -Pnative -Dquarkus.native.container-build=true`. 27 | 28 | You can then execute your native executable with: `./target/simple-quarkus-1.0-SNAPSHOT-runner` 29 | 30 | If you want to learn more about building native executables, please consult https://quarkus.io/guides/building-native-image. -------------------------------------------------------------------------------- /examples/simple-quarkus/requests.http: -------------------------------------------------------------------------------- 1 | 2 | GET http://localhost:8080/artists -------------------------------------------------------------------------------- /examples/simple-quarkus/src/main/docker/Dockerfile.native: -------------------------------------------------------------------------------- 1 | #### 2 | # This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode 3 | # 4 | # Before building the docker image run: 5 | # 6 | # mvn package -Pnative -Dquarkus.native.container-build=true 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.native -t quarkus/simple-quarkus . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/simple-quarkus 15 | # 16 | ### 17 | FROM registry.access.redhat.com/ubi8/ubi-minimal:8.1 18 | WORKDIR /work/ 19 | RUN chown 1001 /work \ 20 | && chmod "g+rwX" /work \ 21 | && chown 1001:root /work 22 | COPY --chown=1001:root target/*-runner /work/application 23 | 24 | EXPOSE 8080 25 | USER 1001 26 | 27 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] -------------------------------------------------------------------------------- /examples/simple-quarkus/src/main/java/org/neo4j/examples/ArtistsResource.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.examples; 2 | 3 | import io.smallrye.mutiny.Multi; 4 | import io.smallrye.mutiny.Uni; 5 | 6 | import javax.inject.Inject; 7 | import javax.ws.rs.GET; 8 | import javax.ws.rs.Path; 9 | import javax.ws.rs.Produces; 10 | import javax.ws.rs.core.MediaType; 11 | 12 | import org.neo4j.driver.Driver; 13 | import org.neo4j.driver.Record; 14 | import org.neo4j.driver.reactive.RxSession; 15 | 16 | @Path("/artists") 17 | public class ArtistsResource { 18 | 19 | private final Driver driver; 20 | 21 | @Inject 22 | public ArtistsResource(Driver driver) { 23 | this.driver = driver; 24 | } 25 | 26 | private Multi executeArtistQuery(RxSession session) { 27 | return Multi.createFrom().publisher( 28 | session.readTransaction(tx -> tx.run("MATCH (n:Artist) RETURN n.name AS name").records()) 29 | ); 30 | } 31 | 32 | @GET 33 | @Produces(MediaType.APPLICATION_JSON) 34 | public Multi getArtists() { 35 | return Uni.createFrom().item(driver::rxSession) 36 | .toMulti() 37 | .flatMap(this::executeArtistQuery) 38 | .map(record -> record.get("name").asString()); 39 | } 40 | } 41 | 42 | /* 43 | @Produces(MediaType.SERVER_SENT_EVENTS) 44 | @SseElementType(MediaType.TEXT_PLAIN) 45 | */ -------------------------------------------------------------------------------- /examples/simple-quarkus/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | quarkus.neo4j.uri = bolt://localhost:7687 2 | quarkus.neo4j.authentication.username = neo4j 3 | quarkus.neo4j.authentication.password = secret 4 | -------------------------------------------------------------------------------- /examples/simple-quarkus/src/main/resources/examples.cypher: -------------------------------------------------------------------------------- 1 | MATCH (n) detach delete n; 2 | 3 | CREATE (q:Artist:Band {name: 'Queen'}) 4 | CREATE (anato:Album {name: 'A Night At The Opera'}) - [:RELEASED_BY] -> (q) 5 | CREATE (innuendo:Album {name: 'Innuendo'}) - [:RELEASED_BY] -> (q) 6 | MERGE (gb:Country {code: 'GB', name: 'Great Britain'}) 7 | MERGE (tz:Country {code: 'TZ', name: 'Tanzania'}) 8 | WITH q, gb, tz 9 | MERGE (q) - [:FOUNDED_IN] -> (gb) 10 | 11 | MERGE (fm:Artist:SoloArtist {name: 'Freddie Mercury'}) 12 | MERGE (fm) - [:BORN_IN] -> (tz) 13 | MERGE (q) - [:HAS_MEMBER {joinedIn: 1970, leftIn: 1991}] -> (fm) 14 | 15 | MERGE (rmt:Artist:SoloArtist {name: 'Roger Taylor'}) 16 | MERGE (rmt) - [:BORN_IN] -> (gb) 17 | MERGE (q) - [:HAS_MEMBER {joinedIn: 1970}] -> (rmt) 18 | 19 | MERGE (bm:Artist:SoloArtist {name: 'Brian May'}) 20 | MERGE (bm) - [:BORN_IN] -> (gb) 21 | MERGE (q) - [:HAS_MEMBER {joinedIn: 1970}] -> (bm) 22 | 23 | 24 | MERGE (deacy:Artist:SoloArtist {name: 'John Deacon'}) 25 | MERGE (deacy) - [:BORN_IN] -> (gb) 26 | MERGE (q) - [:HAS_MEMBER {joinedIn: 1971}] -> (deacy) 27 | 28 | 29 | RETURN *; 30 | 31 | MATCH (a:Album) -[:RELEASED_BY]-> (b:Band), 32 | (c) <-[:FOUNDED_IN]- (b) -[:HAS_MEMBER]-> (m) -[:BORN_IN]-> (c2) 33 | WHERE a.name = 'Innuendo' 34 | RETURN b, m, c, c2 -------------------------------------------------------------------------------- /examples/simple-quarkus/src/test/java/org/neo4j/examples/ArtistsResourceTest.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.examples; 2 | 3 | import static io.restassured.RestAssured.*; 4 | 5 | import io.quarkus.test.junit.QuarkusTest; 6 | 7 | import org.junit.jupiter.api.Test; 8 | 9 | @QuarkusTest 10 | public class ArtistsResourceTest { 11 | 12 | @Test 13 | public void testArtistsEndpoint() { 14 | given() 15 | .when().get("/artists") 16 | .then() 17 | .statusCode(200); 18 | } 19 | } -------------------------------------------------------------------------------- /examples/simple-quarkus/src/test/java/org/neo4j/examples/NativeArtistsResourceIT.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.examples; 2 | 3 | import io.quarkus.test.junit.NativeImageTest; 4 | 5 | @NativeImageTest 6 | public class NativeArtistsResourceIT extends ArtistsResourceTest { 7 | 8 | // Execute the same tests but in native mode. 9 | } -------------------------------------------------------------------------------- /examples/spring-data-async/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /examples/spring-data-async/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michael-simons/neo4j-examples-and-tips/d1dace775ca88441d6680e2bb3a9c9e11edfa8fc/examples/spring-data-async/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /examples/spring-data-async/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar 3 | -------------------------------------------------------------------------------- /examples/spring-data-async/src/main/java/org/neo4j/examples/neo4j_from_the_jvm_ecoysystem/springdataasync/AsyncConfiguration.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.examples.neo4j_from_the_jvm_ecoysystem.springdataasync; 2 | 3 | import java.util.concurrent.Executor; 4 | 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.scheduling.annotation.AsyncConfigurer; 7 | import org.springframework.scheduling.annotation.EnableAsync; 8 | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; 9 | 10 | @Configuration(proxyBeanMethods = false) 11 | @EnableAsync 12 | public class AsyncConfiguration implements AsyncConfigurer { 13 | 14 | public static final long ASYNC_TIMEOUT_SECONDS = 90L; 15 | 16 | @Override 17 | public Executor getAsyncExecutor() { 18 | ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); 19 | executor.setCorePoolSize(500); 20 | executor.setMaxPoolSize(Integer.MAX_VALUE); 21 | executor.setQueueCapacity(0); 22 | executor.setAllowCoreThreadTimeOut(true); 23 | executor.setKeepAliveSeconds((int) ASYNC_TIMEOUT_SECONDS); 24 | 25 | executor.setThreadNamePrefix("AsyncExecutor-"); 26 | executor.initialize(); 27 | return executor; 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /examples/spring-data-async/src/main/java/org/neo4j/examples/neo4j_from_the_jvm_ecoysystem/springdataasync/CustomQueries.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.examples.neo4j_from_the_jvm_ecoysystem.springdataasync; 2 | 3 | import java.util.Collection; 4 | import java.util.Map; 5 | import java.util.function.BiFunction; 6 | 7 | import org.neo4j.driver.Record; 8 | import org.neo4j.driver.types.TypeSystem; 9 | import org.springframework.data.neo4j.core.Neo4jClient; 10 | import org.springframework.stereotype.Service; 11 | import org.springframework.transaction.annotation.Transactional; 12 | 13 | @Service 14 | @Transactional 15 | class CustomQueries { 16 | 17 | private final Neo4jClient neo4jClient; 18 | 19 | public CustomQueries(Neo4jClient neo4jClient) { 20 | this.neo4jClient = neo4jClient; 21 | } 22 | 23 | public Collection getAll(String query, Class type, Map params, 24 | BiFunction mapper) { 25 | return neo4jClient.query(query).bindAll(params).fetchAs(type) 26 | .mappedBy(mapper).all(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /examples/spring-data-async/src/main/java/org/neo4j/examples/neo4j_from_the_jvm_ecoysystem/springdataasync/Movie.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.examples.neo4j_from_the_jvm_ecoysystem.springdataasync; 2 | 3 | import org.springframework.data.neo4j.core.schema.GeneratedValue; 4 | import org.springframework.data.neo4j.core.schema.Id; 5 | import org.springframework.data.neo4j.core.schema.Node; 6 | 7 | @Node 8 | public class Movie { 9 | 10 | @Id @GeneratedValue 11 | Long id; 12 | 13 | String title; 14 | 15 | public Long getId() { 16 | return id; 17 | } 18 | 19 | public String getTitle() { 20 | return title; 21 | } 22 | 23 | public void setTitle(String title) { 24 | this.title = title; 25 | } 26 | 27 | @Override public String toString() { 28 | return "Movie{" + 29 | "id=" + id + 30 | ", title='" + title + '\'' + 31 | '}'; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /examples/spring-data-async/src/main/java/org/neo4j/examples/neo4j_from_the_jvm_ecoysystem/springdataasync/SpringDataAsyncApplication.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.examples.neo4j_from_the_jvm_ecoysystem.springdataasync; 2 | 3 | import java.util.concurrent.Executor; 4 | 5 | import org.springframework.boot.SpringApplication; 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; 7 | import org.springframework.scheduling.annotation.AsyncConfigurer; 8 | import org.springframework.scheduling.annotation.EnableAsync; 9 | import org.springframework.stereotype.Component; 10 | 11 | @SpringBootApplication 12 | public class SpringDataAsyncApplication { 13 | 14 | public static void main(String[] args) { 15 | SpringApplication.run(SpringDataAsyncApplication.class, args); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /examples/spring-data-async/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.transaction.default-timeout=1s 2 | spring.neo4j.authentication.password=secret 3 | spring.neo4j.authentication.username=neo4j 4 | -------------------------------------------------------------------------------- /examples/spring-data-async/src/main/resources/neo4j/migrations/beforeMigrate.cypher: -------------------------------------------------------------------------------- 1 | MATCH (n:Movie) detach delete n; 2 | MATCH (n:Person) detach delete n; -------------------------------------------------------------------------------- /examples/spring-data-async/src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /examples/testing-ogm-against-embedded-with-apoc/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /examples/testing-ogm-against-embedded-with-apoc/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michael-simons/neo4j-examples-and-tips/d1dace775ca88441d6680e2bb3a9c9e11edfa8fc/examples/testing-ogm-against-embedded-with-apoc/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /examples/testing-ogm-against-embedded-with-apoc/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /examples/testing-ogm-against-embedded-with-apoc/requests.http: -------------------------------------------------------------------------------- 1 | ### Some movies 2 | GET localhost:8080/movies 3 | 4 | ### Actuator 5 | GET localhost:8080/actuator/info 6 | -------------------------------------------------------------------------------- /examples/testing-ogm-against-embedded-with-apoc/src/main/java/org/neo4j/tips/testing/testing_ogm_against_embedded_with_apoc/Application.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 "Neo4j," 3 | * Neo4j Sweden AB [http://neo4j.com] 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.neo4j.tips.testing.testing_ogm_against_embedded_with_apoc; 18 | 19 | import org.springframework.boot.SpringApplication; 20 | import org.springframework.boot.autoconfigure.SpringBootApplication; 21 | 22 | /** 23 | * @author Michael J. Simons 24 | */ 25 | @SpringBootApplication 26 | public class Application { 27 | 28 | public static void main(String[] args) { 29 | SpringApplication.run(Application.class, args); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /examples/testing-ogm-against-embedded-with-apoc/src/main/java/org/neo4j/tips/testing/testing_ogm_against_embedded_with_apoc/MovieController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 "Neo4j," 3 | * Neo4j Sweden AB [http://neo4j.com] 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.neo4j.tips.testing.testing_ogm_against_embedded_with_apoc; 18 | 19 | import org.springframework.web.bind.annotation.GetMapping; 20 | import org.springframework.web.bind.annotation.RequestMapping; 21 | import org.springframework.web.bind.annotation.RestController; 22 | 23 | /** 24 | * @author Michael J. Simons 25 | */ 26 | @RestController 27 | @RequestMapping("/movies") 28 | public class MovieController { 29 | 30 | private final MovieRepository movieRepository; 31 | 32 | public MovieController(MovieRepository movieRepository) { 33 | this.movieRepository = movieRepository; 34 | } 35 | 36 | @GetMapping 37 | public Iterable getMovies() { 38 | 39 | return movieRepository.findAll(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /examples/testing-ogm-against-embedded-with-apoc/src/main/java/org/neo4j/tips/testing/testing_ogm_against_embedded_with_apoc/MovieEntity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 "Neo4j," 3 | * Neo4j Sweden AB [http://neo4j.com] 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.neo4j.tips.testing.testing_ogm_against_embedded_with_apoc; 18 | 19 | import org.neo4j.ogm.annotation.GeneratedValue; 20 | import org.neo4j.ogm.annotation.Id; 21 | import org.neo4j.ogm.annotation.NodeEntity; 22 | 23 | /** 24 | * @author Michael J. Simons 25 | */ 26 | @NodeEntity("Movie") 27 | public class MovieEntity { 28 | 29 | @Id @GeneratedValue 30 | private Long id; 31 | 32 | private String title; 33 | 34 | public Long getId() { 35 | return id; 36 | } 37 | 38 | public String getTitle() { 39 | return title; 40 | } 41 | 42 | public void setTitle(String title) { 43 | this.title = title; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /examples/testing-ogm-against-embedded-with-apoc/src/main/java/org/neo4j/tips/testing/testing_ogm_against_embedded_with_apoc/MovieRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 "Neo4j," 3 | * Neo4j Sweden AB [http://neo4j.com] 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.neo4j.tips.testing.testing_ogm_against_embedded_with_apoc; 18 | 19 | import org.springframework.data.neo4j.repository.Neo4jRepository; 20 | 21 | /** 22 | * @author Michael J. Simons 23 | */ 24 | public interface MovieRepository extends Neo4jRepository { 25 | } 26 | -------------------------------------------------------------------------------- /examples/testing-ogm-against-embedded-with-apoc/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.data.neo4j.uri=bolt://localhost:7687 2 | spring.data.neo4j.username=neo4j 3 | spring.data.neo4j.password=secret 4 | -------------------------------------------------------------------------------- /examples/testing-ogm-against-embedded-with-apoc/src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /examples/testing-ogm-against-testcontainers-with-apoc/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /examples/testing-ogm-against-testcontainers-with-apoc/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michael-simons/neo4j-examples-and-tips/d1dace775ca88441d6680e2bb3a9c9e11edfa8fc/examples/testing-ogm-against-testcontainers-with-apoc/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /examples/testing-ogm-against-testcontainers-with-apoc/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /examples/testing-ogm-against-testcontainers-with-apoc/requests.http: -------------------------------------------------------------------------------- 1 | ### Some movies 2 | GET localhost:8080/movies 3 | 4 | ### Actuator 5 | GET localhost:8080/actuator/info 6 | -------------------------------------------------------------------------------- /examples/testing-ogm-against-testcontainers-with-apoc/src/main/java/org/neo4j/tips/testing/testing_ogm_against_testcontainers_with_apoc/Application.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 "Neo4j," 3 | * Neo4j Sweden AB [http://neo4j.com] 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.neo4j.tips.testing.testing_ogm_against_testcontainers_with_apoc; 18 | 19 | import org.springframework.boot.SpringApplication; 20 | import org.springframework.boot.autoconfigure.SpringBootApplication; 21 | 22 | /** 23 | * @author Michael J. Simons 24 | */ 25 | @SpringBootApplication 26 | public class Application { 27 | 28 | public static void main(String[] args) { 29 | SpringApplication.run(Application.class, args); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /examples/testing-ogm-against-testcontainers-with-apoc/src/main/java/org/neo4j/tips/testing/testing_ogm_against_testcontainers_with_apoc/MovieEntity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 "Neo4j," 3 | * Neo4j Sweden AB [http://neo4j.com] 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.neo4j.tips.testing.testing_ogm_against_testcontainers_with_apoc; 18 | 19 | import org.neo4j.ogm.annotation.GeneratedValue; 20 | import org.neo4j.ogm.annotation.Id; 21 | import org.neo4j.ogm.annotation.NodeEntity; 22 | 23 | /** 24 | * @author Michael J. Simons 25 | */ 26 | @NodeEntity("Movie") 27 | public class MovieEntity { 28 | 29 | @Id @GeneratedValue 30 | private Long id; 31 | 32 | private String title; 33 | 34 | public Long getId() { 35 | return id; 36 | } 37 | 38 | public String getTitle() { 39 | return title; 40 | } 41 | 42 | public void setTitle(String title) { 43 | this.title = title; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /examples/testing-ogm-against-testcontainers-with-apoc/src/main/java/org/neo4j/tips/testing/testing_ogm_against_testcontainers_with_apoc/MovieRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 "Neo4j," 3 | * Neo4j Sweden AB [http://neo4j.com] 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.neo4j.tips.testing.testing_ogm_against_testcontainers_with_apoc; 18 | 19 | import org.springframework.data.neo4j.repository.Neo4jRepository; 20 | 21 | /** 22 | * @author Michael J. Simons 23 | */ 24 | public interface MovieRepository extends Neo4jRepository { 25 | } 26 | -------------------------------------------------------------------------------- /examples/testing-ogm-against-testcontainers-with-apoc/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.data.neo4j.uri=bolt://localhost:7687 2 | spring.data.neo4j.username=neo4j 3 | spring.data.neo4j.password=secret 4 | -------------------------------------------------------------------------------- /examples/testing-ogm-against-testcontainers-with-apoc/src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /examples/understand-the-type-system/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michael-simons/neo4j-examples-and-tips/d1dace775ca88441d6680e2bb3a9c9e11edfa8fc/examples/understand-the-type-system/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /examples/understand-the-type-system/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip -------------------------------------------------------------------------------- /examples/understand-the-type-system/README.adoc: -------------------------------------------------------------------------------- 1 | = understand-the-type-system 2 | 3 | You'll need JDK 10+ to compile and run this project. 4 | Use `./mvnw clean package` to compile and run all tests. -------------------------------------------------------------------------------- /examples/understand-the-type-system/src/main/resources/simplelogger.properties: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 "Neo4j, Inc." 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | org.slf4j.simpleLogger.defaultLogLevel=debug 15 | -------------------------------------------------------------------------------- /examples/use-dynamic-finder/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | 4 | ### STS ### 5 | .apt_generated 6 | .classpath 7 | .factorypath 8 | .project 9 | .settings 10 | .springBeans 11 | .sts4-cache 12 | 13 | ### IntelliJ IDEA ### 14 | .idea 15 | *.iws 16 | *.iml 17 | *.ipr 18 | 19 | ### NetBeans ### 20 | /nbproject/private/ 21 | /build/ 22 | /nbbuild/ 23 | /dist/ 24 | /nbdist/ 25 | /.nb-gradle/ -------------------------------------------------------------------------------- /examples/use-dynamic-finder/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michael-simons/neo4j-examples-and-tips/d1dace775ca88441d6680e2bb3a9c9e11edfa8fc/examples/use-dynamic-finder/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /examples/use-dynamic-finder/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip 2 | -------------------------------------------------------------------------------- /examples/use-dynamic-finder/src/main/java/org/neo4j/tips/sdn/use_dynamic_finder/domain/Thing.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 "Neo4j, Inc." 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.neo4j.tips.sdn.use_dynamic_finder.domain; 17 | 18 | import org.neo4j.ogm.annotation.NodeEntity; 19 | 20 | /** 21 | * @author Michael J. Simons 22 | */ 23 | @NodeEntity 24 | public class Thing { 25 | private Long id; 26 | 27 | private String name; 28 | 29 | private String description; 30 | 31 | private Double price; 32 | 33 | Thing() { 34 | } 35 | 36 | public Thing(String name, String description, Double price) { 37 | this.name = name; 38 | this.description = description; 39 | this.price = price; 40 | } 41 | 42 | public String getName() { 43 | return name; 44 | } 45 | 46 | public String getDescription() { 47 | return description; 48 | } 49 | 50 | public Double getPrice() { 51 | return price; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /examples/use-dynamic-finder/src/main/java/org/neo4j/tips/sdn/use_dynamic_finder/domain/ThingRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 "Neo4j, Inc." 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.neo4j.tips.sdn.use_dynamic_finder.domain; 17 | 18 | import org.springframework.data.neo4j.repository.Neo4jRepository; 19 | 20 | /** 21 | * @author Michael J. Simons 22 | */ 23 | // tag::use-the-custom-method[] 24 | public interface ThingRepository extends Neo4jRepository { 25 | Iterable findAllByPropertyValue(String property, Object value); 26 | } 27 | // end::use-the-custom-method[] 28 | -------------------------------------------------------------------------------- /examples/use-dynamic-finder/src/main/resources/application.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michael-simons/neo4j-examples-and-tips/d1dace775ca88441d6680e2bb3a9c9e11edfa8fc/examples/use-dynamic-finder/src/main/resources/application.properties -------------------------------------------------------------------------------- /examples/using-multiple-session-factories/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | 4 | ### STS ### 5 | .apt_generated 6 | .classpath 7 | .factorypath 8 | .project 9 | .settings 10 | .springBeans 11 | .sts4-cache 12 | 13 | ### IntelliJ IDEA ### 14 | .idea 15 | *.iws 16 | *.iml 17 | *.ipr 18 | 19 | ### NetBeans ### 20 | /nbproject/private/ 21 | /build/ 22 | /nbbuild/ 23 | /dist/ 24 | /nbdist/ 25 | /.nb-gradle/ -------------------------------------------------------------------------------- /examples/using-multiple-session-factories/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michael-simons/neo4j-examples-and-tips/d1dace775ca88441d6680e2bb3a9c9e11edfa8fc/examples/using-multiple-session-factories/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /examples/using-multiple-session-factories/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip 2 | -------------------------------------------------------------------------------- /examples/using-multiple-session-factories/README.adoc: -------------------------------------------------------------------------------- 1 | = using-multiple-session-factories 2 | 3 | You'll need JDK 10+ to compile and run this project. 4 | Use `./mvnw clean package` to compile and run all tests. 5 | 6 | To use multiple Neo4j session factories to different Neo4j instances, you need those instances. 7 | You can either start them yourself or if you have https://www.docker.com/community-edition[Docker] installed use the provided Maven target `./mvnw docker:start` to create 2 different instances. 8 | 9 | You can access them at http://localhost:7474[localhost:7474] and http://localhost:7475[localhost:7475] using Bolt port `7687` respectively `7688`. 10 | 11 | The application is configured to use the following instances: 12 | 13 | [source,properties] 14 | [[spring-data-neo4j-configuration]] 15 | .application.properties 16 | ---- 17 | include::src/main/resources/application.properties[tags=spring-data-neo4j-configuration] 18 | ---- 19 | 20 | One instance with username/password of `neo4j/domain1` and Bolt the default port and the other with `neo4j/domain2` and Bolt on port `7688`. 21 | 22 | If you have started two Neo4j instances on the ports as shown above, use `./mvnw spring-boot:run` to create two different entities, on in each instance. 23 | The name of the entities will then be retrieved again. 24 | You can open your browser at the above URL to convince yourself that the `FooEntity` went to the instance for domain1, the `BarEntity` to domain2. 25 | 26 | To stop the container instances, use `./mvnw docker:stop`. 27 | -------------------------------------------------------------------------------- /examples/using-multiple-session-factories/src/main/java/org/neo4j/tips/sdn/using_multiple_session_factories/domain1/FooEntity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 "Neo4j, Inc." 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.neo4j.tips.sdn.using_multiple_session_factories.domain1; 17 | 18 | import org.neo4j.ogm.annotation.GeneratedValue; 19 | import org.neo4j.ogm.annotation.Id; 20 | import org.neo4j.ogm.annotation.NodeEntity; 21 | 22 | /** 23 | * @author Michael J. Simons 24 | */ 25 | @NodeEntity(label = "Foo") 26 | public class FooEntity { 27 | 28 | @Id 29 | @GeneratedValue 30 | private Long id; 31 | 32 | private String name; 33 | 34 | public FooEntity(String name) { 35 | this.name = name; 36 | } 37 | 38 | public Long getId() { 39 | return id; 40 | } 41 | 42 | public String getName() { 43 | return name; 44 | } 45 | 46 | public void setName(String name) { 47 | this.name = name; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /examples/using-multiple-session-factories/src/main/java/org/neo4j/tips/sdn/using_multiple_session_factories/domain1/FooRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 "Neo4j, Inc." 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.neo4j.tips.sdn.using_multiple_session_factories.domain1; 17 | 18 | import org.neo4j.tips.sdn.using_multiple_session_factories.domain2.BarEntity; 19 | import org.springframework.data.neo4j.repository.Neo4jRepository; 20 | 21 | /** 22 | * @author Michael J. Simons 23 | */ 24 | public interface FooRepository extends Neo4jRepository { 25 | } 26 | -------------------------------------------------------------------------------- /examples/using-multiple-session-factories/src/main/java/org/neo4j/tips/sdn/using_multiple_session_factories/domain2/BarEntity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 "Neo4j, Inc." 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.neo4j.tips.sdn.using_multiple_session_factories.domain2; 17 | 18 | import org.neo4j.ogm.annotation.GeneratedValue; 19 | import org.neo4j.ogm.annotation.Id; 20 | import org.neo4j.ogm.annotation.NodeEntity; 21 | 22 | /** 23 | * @author Michael J. Simons 24 | */ 25 | @NodeEntity(label = "Bar") 26 | public class BarEntity { 27 | 28 | @Id 29 | @GeneratedValue 30 | private Long id; 31 | 32 | private String name; 33 | 34 | public BarEntity(String name) { 35 | this.name = name; 36 | } 37 | 38 | public Long getId() { 39 | return id; 40 | } 41 | 42 | public String getName() { 43 | return name; 44 | } 45 | 46 | public void setName(String name) { 47 | this.name = name; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /examples/using-multiple-session-factories/src/main/java/org/neo4j/tips/sdn/using_multiple_session_factories/domain2/BarRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 "Neo4j, Inc." 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.neo4j.tips.sdn.using_multiple_session_factories.domain2; 17 | 18 | import org.springframework.data.neo4j.repository.Neo4jRepository; 19 | 20 | /** 21 | * @author Michael J. Simons 22 | */ 23 | public interface BarRepository extends Neo4jRepository {} 24 | -------------------------------------------------------------------------------- /examples/using-multiple-session-factories/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | # tag::spring-data-neo4j-configuration[] 2 | # Configuration for entities and repositories in "domain1" 3 | spring.data.neo4j.username = neo4j 4 | spring.data.neo4j.password = domain1 5 | spring.data.neo4j.uri = bolt://localhost:7687 6 | 7 | # Configuration for entities and repositories in "domain2" 8 | spring.data.neo4j.domain2.username = neo4j 9 | spring.data.neo4j.domain2.password = domain2 10 | spring.data.neo4j.domain2.uri = bolt://localhost:7688 11 | # end::spring-data-neo4j-configuration[] 12 | -------------------------------------------------------------------------------- /examples/using-multiple-session-factories/src/test/java/org/neo4j/tips/sdn/using_multiple_session_factories/UsingMultipleSessionFactoriesApplicationIT.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.sdn.using_multiple_session_factories; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class UsingMultipleSessionFactoriesApplicationIT { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /examples/using-testcontainers/src/main/java/org/neo4j/tips/testing/using_testcontainers/DemoApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 "Neo4j," 3 | * Neo4j Sweden AB [http://neo4j.com] 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.neo4j.tips.testing.using_testcontainers; 18 | 19 | import org.springframework.boot.SpringApplication; 20 | import org.springframework.boot.autoconfigure.SpringBootApplication; 21 | import org.springframework.data.neo4j.annotation.EnableNeo4jAuditing; 22 | 23 | /** 24 | * @author Michael J. Simons 25 | */ 26 | @SpringBootApplication 27 | @EnableNeo4jAuditing 28 | public class DemoApplication { 29 | public static void main(String... args) { 30 | SpringApplication.run(DemoApplication.class, args); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /examples/using-testcontainers/src/main/java/org/neo4j/tips/testing/using_testcontainers/domain/Thing.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 "Neo4j," 3 | * Neo4j Sweden AB [http://neo4j.com] 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.neo4j.tips.testing.using_testcontainers.domain; 18 | 19 | import org.neo4j.ogm.annotation.GeneratedValue; 20 | import org.neo4j.ogm.annotation.Id; 21 | 22 | /** 23 | * @author Michael J. Simons 24 | */ 25 | public class Thing { 26 | 27 | @Id @GeneratedValue 28 | private Long id; 29 | 30 | private String name; 31 | 32 | public Long getId() { 33 | return id; 34 | } 35 | 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /examples/using-testcontainers/src/main/java/org/neo4j/tips/testing/using_testcontainers/domain/ThingRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 "Neo4j," 3 | * Neo4j Sweden AB [http://neo4j.com] 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.neo4j.tips.testing.using_testcontainers.domain; 18 | 19 | import java.util.List; 20 | 21 | import org.springframework.data.neo4j.annotation.Query; 22 | import org.springframework.data.neo4j.repository.Neo4jRepository; 23 | 24 | /** 25 | * @author Michael J. Simons 26 | */ 27 | // tag::thing-repository[] 28 | public interface ThingRepository extends Neo4jRepository { 29 | 30 | List findThingByNameMatchesRegex(String regexForName); 31 | 32 | @Query(value 33 | = " MATCH (t:Thing) WHERE t.name = $name" 34 | + " RETURN t.name AS name, examples.getGeometry(t) AS wkt") 35 | ThingWithGeometry findThingWithGeometry(String name); 36 | } 37 | // end::thing-repository[] 38 | -------------------------------------------------------------------------------- /examples/using-testcontainers/src/main/java/org/neo4j/tips/testing/using_testcontainers/domain/ThingWithGeometry.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.testing.using_testcontainers.domain; 2 | 3 | import org.springframework.data.neo4j.annotation.QueryResult; 4 | 5 | @QueryResult 6 | public class ThingWithGeometry { 7 | private String name; 8 | 9 | private String wkt; 10 | 11 | public ThingWithGeometry(String name, String wkt) { 12 | this.name = name; 13 | this.wkt = wkt; 14 | } 15 | 16 | public String getName() { 17 | return name; 18 | } 19 | 20 | public String getWkt() { 21 | return wkt; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /examples/using-testcontainers/src/test/resources/geometry-toolbox.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michael-simons/neo4j-examples-and-tips/d1dace775ca88441d6680e2bb3a9c9e11edfa8fc/examples/using-testcontainers/src/test/resources/geometry-toolbox.jar -------------------------------------------------------------------------------- /examples/using-testcontainers/src/test/resources/test-graph.db/neostore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michael-simons/neo4j-examples-and-tips/d1dace775ca88441d6680e2bb3a9c9e11edfa8fc/examples/using-testcontainers/src/test/resources/test-graph.db/neostore -------------------------------------------------------------------------------- /examples/using-testcontainers/src/test/resources/test-graph.db/neostore.counts.db.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michael-simons/neo4j-examples-and-tips/d1dace775ca88441d6680e2bb3a9c9e11edfa8fc/examples/using-testcontainers/src/test/resources/test-graph.db/neostore.counts.db.a -------------------------------------------------------------------------------- /examples/using-testcontainers/src/test/resources/test-graph.db/neostore.counts.db.b: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michael-simons/neo4j-examples-and-tips/d1dace775ca88441d6680e2bb3a9c9e11edfa8fc/examples/using-testcontainers/src/test/resources/test-graph.db/neostore.counts.db.b -------------------------------------------------------------------------------- /examples/using-testcontainers/src/test/resources/test-graph.db/neostore.id: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /examples/using-testcontainers/src/test/resources/test-graph.db/neostore.labeltokenstore.db.id: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /examples/using-testcontainers/src/test/resources/test-graph.db/neostore.labeltokenstore.db.names: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michael-simons/neo4j-examples-and-tips/d1dace775ca88441d6680e2bb3a9c9e11edfa8fc/examples/using-testcontainers/src/test/resources/test-graph.db/neostore.labeltokenstore.db.names -------------------------------------------------------------------------------- /examples/using-testcontainers/src/test/resources/test-graph.db/neostore.labeltokenstore.db.names.id: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /examples/using-testcontainers/src/test/resources/test-graph.db/neostore.nodestore.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michael-simons/neo4j-examples-and-tips/d1dace775ca88441d6680e2bb3a9c9e11edfa8fc/examples/using-testcontainers/src/test/resources/test-graph.db/neostore.nodestore.db -------------------------------------------------------------------------------- /examples/using-testcontainers/src/test/resources/test-graph.db/neostore.nodestore.db.id: -------------------------------------------------------------------------------- 1 |  2 |  -------------------------------------------------------------------------------- /examples/using-testcontainers/src/test/resources/test-graph.db/neostore.nodestore.db.labels.id: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /examples/using-testcontainers/src/test/resources/test-graph.db/neostore.propertystore.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michael-simons/neo4j-examples-and-tips/d1dace775ca88441d6680e2bb3a9c9e11edfa8fc/examples/using-testcontainers/src/test/resources/test-graph.db/neostore.propertystore.db -------------------------------------------------------------------------------- /examples/using-testcontainers/src/test/resources/test-graph.db/neostore.propertystore.db.arrays: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michael-simons/neo4j-examples-and-tips/d1dace775ca88441d6680e2bb3a9c9e11edfa8fc/examples/using-testcontainers/src/test/resources/test-graph.db/neostore.propertystore.db.arrays -------------------------------------------------------------------------------- /examples/using-testcontainers/src/test/resources/test-graph.db/neostore.propertystore.db.arrays.id: -------------------------------------------------------------------------------- 1 |  2 |  -------------------------------------------------------------------------------- /examples/using-testcontainers/src/test/resources/test-graph.db/neostore.propertystore.db.id: -------------------------------------------------------------------------------- 1 |  2 |  -------------------------------------------------------------------------------- /examples/using-testcontainers/src/test/resources/test-graph.db/neostore.propertystore.db.index.id: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /examples/using-testcontainers/src/test/resources/test-graph.db/neostore.propertystore.db.index.keys: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michael-simons/neo4j-examples-and-tips/d1dace775ca88441d6680e2bb3a9c9e11edfa8fc/examples/using-testcontainers/src/test/resources/test-graph.db/neostore.propertystore.db.index.keys -------------------------------------------------------------------------------- /examples/using-testcontainers/src/test/resources/test-graph.db/neostore.propertystore.db.index.keys.id: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /examples/using-testcontainers/src/test/resources/test-graph.db/neostore.propertystore.db.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michael-simons/neo4j-examples-and-tips/d1dace775ca88441d6680e2bb3a9c9e11edfa8fc/examples/using-testcontainers/src/test/resources/test-graph.db/neostore.propertystore.db.strings -------------------------------------------------------------------------------- /examples/using-testcontainers/src/test/resources/test-graph.db/neostore.propertystore.db.strings.id: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /examples/using-testcontainers/src/test/resources/test-graph.db/neostore.relationshipgroupstore.db.id: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /examples/using-testcontainers/src/test/resources/test-graph.db/neostore.relationshipstore.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michael-simons/neo4j-examples-and-tips/d1dace775ca88441d6680e2bb3a9c9e11edfa8fc/examples/using-testcontainers/src/test/resources/test-graph.db/neostore.relationshipstore.db -------------------------------------------------------------------------------- /examples/using-testcontainers/src/test/resources/test-graph.db/neostore.relationshipstore.db.id: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/using-testcontainers/src/test/resources/test-graph.db/neostore.relationshiptypestore.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michael-simons/neo4j-examples-and-tips/d1dace775ca88441d6680e2bb3a9c9e11edfa8fc/examples/using-testcontainers/src/test/resources/test-graph.db/neostore.relationshiptypestore.db -------------------------------------------------------------------------------- /examples/using-testcontainers/src/test/resources/test-graph.db/neostore.relationshiptypestore.db.id: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/using-testcontainers/src/test/resources/test-graph.db/neostore.relationshiptypestore.db.names.id: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /examples/using-testcontainers/src/test/resources/test-graph.db/neostore.schemastore.db.id: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /examples/using-testcontainers/src/test/resources/test-graph.db/neostore.transaction.db.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michael-simons/neo4j-examples-and-tips/d1dace775ca88441d6680e2bb3a9c9e11edfa8fc/examples/using-testcontainers/src/test/resources/test-graph.db/neostore.transaction.db.0 -------------------------------------------------------------------------------- /examples/using-the-test-harness-ee/src/main/java/org/neo4j/tips/testing/using_the_test_harness_ee/DisplayMetadata.java: -------------------------------------------------------------------------------- 1 | package org.neo4j.tips.testing.using_the_test_harness_ee; 2 | 3 | import static java.util.stream.Collectors.*; 4 | 5 | import java.util.Map; 6 | 7 | import org.neo4j.graphdb.GraphDatabaseService; 8 | import org.neo4j.kernel.api.KernelTransaction; 9 | import org.neo4j.kernel.impl.api.KernelTransactionImplementation; 10 | import org.neo4j.procedure.Context; 11 | import org.neo4j.procedure.UserFunction; 12 | 13 | public class DisplayMetadata { 14 | 15 | @Context 16 | public GraphDatabaseService db; 17 | 18 | @Context public KernelTransaction currentTransaction; 19 | 20 | @UserFunction("examples.mirrorMeta") 21 | public String apply() { 22 | 23 | /* Official way 24 | Result result = db.execute("CALL dbms.getTXMetaData()"); 25 | Map metaData = (Map) result.next().get("metadata"); 26 | */ 27 | 28 | Map metaData = ((KernelTransactionImplementation) currentTransaction).getMetaData(); 29 | return metaData.entrySet().stream().map(e -> e.getKey() + " = " + e.getValue()).collect(joining(", ")); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /examples/validate-transaction-settings/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | 4 | ### STS ### 5 | .apt_generated 6 | .classpath 7 | .factorypath 8 | .project 9 | .settings 10 | .springBeans 11 | .sts4-cache 12 | 13 | ### IntelliJ IDEA ### 14 | .idea 15 | *.iws 16 | *.iml 17 | *.ipr 18 | 19 | ### NetBeans ### 20 | /nbproject/private/ 21 | /build/ 22 | /nbbuild/ 23 | /dist/ 24 | /nbdist/ 25 | /.nb-gradle/ -------------------------------------------------------------------------------- /examples/validate-transaction-settings/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michael-simons/neo4j-examples-and-tips/d1dace775ca88441d6680e2bb3a9c9e11edfa8fc/examples/validate-transaction-settings/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /examples/validate-transaction-settings/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip 2 | -------------------------------------------------------------------------------- /examples/validate-transaction-settings/src/main/java/org/neo4j/tips/sdn/validate_transaction_settings/BrokenService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 "Neo4j, Inc." 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.neo4j.tips.sdn.validate_transaction_settings; 17 | 18 | import org.springframework.stereotype.Service; 19 | import org.springframework.transaction.annotation.Transactional; 20 | 21 | /** 22 | * @author Michael J. Simons 23 | */ 24 | // tag::broken-service[] 25 | @Service 26 | public class BrokenService { 27 | private final ThingRepository thingRepository; 28 | 29 | public BrokenService(ThingRepository thingRepository) { 30 | this.thingRepository = thingRepository; 31 | } 32 | 33 | @Transactional(readOnly = true) 34 | public ThingEntity tryToWriteInReadOnlyTx() { 35 | return this.thingRepository.save(new ThingEntity("A thing")); // <1> 36 | } 37 | } 38 | // end::broken-service[] 39 | -------------------------------------------------------------------------------- /examples/validate-transaction-settings/src/main/java/org/neo4j/tips/sdn/validate_transaction_settings/ThingEntity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 "Neo4j, Inc." 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.neo4j.tips.sdn.validate_transaction_settings; 17 | 18 | import org.neo4j.ogm.annotation.NodeEntity; 19 | 20 | /** 21 | * @author Michael J. Simons 22 | */ 23 | @NodeEntity 24 | public class ThingEntity { 25 | private Long id; 26 | 27 | private String name; 28 | 29 | ThingEntity() { 30 | } 31 | 32 | public ThingEntity(String name) { 33 | this.name = name; 34 | } 35 | 36 | public Long getId() { 37 | return id; 38 | } 39 | 40 | public String getName() { 41 | return name; 42 | } 43 | 44 | public void setName(String name) { 45 | this.name = name; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /examples/validate-transaction-settings/src/main/java/org/neo4j/tips/sdn/validate_transaction_settings/ThingRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 "Neo4j, Inc." 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.neo4j.tips.sdn.validate_transaction_settings; 17 | 18 | import org.springframework.data.neo4j.repository.Neo4jRepository; 19 | 20 | /** 21 | * @author Michael J. Simons 22 | */ 23 | public interface ThingRepository extends Neo4jRepository { 24 | } 25 | -------------------------------------------------------------------------------- /examples/validate-transaction-settings/src/main/java/org/neo4j/tips/sdn/validate_transaction_settings/ValidateTransactionSettingsApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 "Neo4j, Inc." 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.neo4j.tips.sdn.validate_transaction_settings; 17 | 18 | import org.springframework.boot.SpringApplication; 19 | import org.springframework.boot.autoconfigure.SpringBootApplication; 20 | 21 | /** 22 | * @author Michael J. Simons 23 | */ 24 | @SpringBootApplication 25 | public class ValidateTransactionSettingsApplication { 26 | 27 | public static void main(String[] args) { 28 | SpringApplication.run(ValidateTransactionSettingsApplication.class, args); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /examples/validate-transaction-settings/src/main/resources/application.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michael-simons/neo4j-examples-and-tips/d1dace775ca88441d6680e2bb3a9c9e11edfa8fc/examples/validate-transaction-settings/src/main/resources/application.properties -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michael-simons/neo4j-examples-and-tips/d1dace775ca88441d6680e2bb3a9c9e11edfa8fc/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = "neo4j-sdn-ogm-tips" -------------------------------------------------------------------------------- /src/main/asciidoc/images/using_multiple_session_factories-properties-support.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michael-simons/neo4j-examples-and-tips/d1dace775ca88441d6680e2bb3a9c9e11edfa8fc/src/main/asciidoc/images/using_multiple_session_factories-properties-support.gif --------------------------------------------------------------------------------