├── .github ├── dependabot.yml └── workflows │ └── pull_requests.yml ├── .gitignore ├── .mvn └── wrapper │ ├── maven-wrapper.jar │ └── maven-wrapper.properties ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── documentation └── asciidoc │ ├── stories │ ├── assembly_embedded_tutorials.adoc │ ├── assembly_hibernate_tutorials.adoc │ ├── assembly_remote_tutorials.adoc │ └── assembly_spring_tutorials.adoc │ ├── titles │ ├── simple_tutorials.asciidoc │ └── stories.adoc │ └── topics │ ├── attributes │ ├── community-attributes.adoc │ ├── downstream-attributes.adoc │ └── mvn_commands.adoc │ ├── proc_building_and_running.adoc │ ├── ref_cross_site_replication.adoc │ ├── ref_embedded_kubernetes_tutorial.adoc │ ├── ref_embedded_tutorials.adoc │ ├── ref_hibernate_tutorials.adoc │ ├── ref_hotrod_cpp_tutorials.adoc │ ├── ref_hotrod_dotnet_tutorials.adoc │ ├── ref_hotrod_java_tutorials.adoc │ ├── ref_hotrod_js_tutorials.adoc │ ├── ref_remote_tutorials.adoc │ ├── ref_secured_with_token_keycloak.adoc │ ├── ref_spatial_queries.adoc │ ├── ref_spring_tutorials.adoc │ └── ref_tracing_opentelemetry.adoc ├── infinispan-embedded ├── cache-alias │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── infinispan │ │ │ └── tutorial │ │ │ └── simple │ │ │ └── alias │ │ │ └── InfinispanCacheAlias.java │ │ └── test │ │ └── java │ │ └── org │ │ └── infinispan │ │ └── tutorial │ │ └── simple │ │ └── alias │ │ └── InfinispanCacheAliasTest.java ├── cache-distributed │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── infinispan │ │ │ └── tutorial │ │ │ └── simple │ │ │ └── distributed │ │ │ └── InfinispanDistributed.java │ │ └── test │ │ └── java │ │ └── org │ │ └── infinispan │ │ └── tutorial │ │ └── simple │ │ └── distributed │ │ └── InfinispanDistributedTest.java ├── cache-invalidated │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── infinispan │ │ │ └── tutorial │ │ │ └── simple │ │ │ └── invalidation │ │ │ └── InvalidationMode.java │ │ └── test │ │ └── java │ │ └── org │ │ └── infinispan │ │ └── tutorial │ │ └── simple │ │ └── invalidation │ │ └── InvalidationModeTest.java ├── cache-replicated │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── infinispan │ │ │ └── tutorial │ │ │ └── simple │ │ │ └── replicated │ │ │ └── InfinispanReplicated.java │ │ └── test │ │ └── java │ │ └── org │ │ └── infinispan │ │ └── tutorial │ │ └── simple │ │ └── replicated │ │ └── InfinispanReplicatedTest.java ├── clusterexec │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── infinispan │ │ │ └── tutorial │ │ │ └── simple │ │ │ └── clusterexec │ │ │ └── InfinispanClusterExec.java │ │ └── test │ │ └── java │ │ └── org │ │ └── infinispan │ │ └── tutorial │ │ └── simple │ │ └── clusterexec │ │ └── InfinispanClusterExecTest.java ├── counter │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── infinispan │ │ │ └── tutorial │ │ │ └── simple │ │ │ └── counter │ │ │ └── InfinispanCounter.java │ │ └── test │ │ └── java │ │ └── org │ │ └── infinispan │ │ └── tutorial │ │ └── simple │ │ └── counter │ │ └── InfinispanCounterTest.java ├── functional │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── infinispan │ │ │ └── tutorial │ │ │ └── simple │ │ │ └── functional │ │ │ └── InfinispanFunctional.java │ │ └── test │ │ └── java │ │ └── org │ │ └── infinispan │ │ └── tutorial │ │ └── simple │ │ └── functional │ │ └── InfinispanFunctionalTest.java ├── jcache │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── infinispan │ │ │ └── tutorial │ │ │ └── simple │ │ │ └── jcache │ │ │ └── InfinispanJCache.java │ │ └── test │ │ └── java │ │ └── org │ │ └── infinispan │ │ └── tutorial │ │ └── simple │ │ └── jcache │ │ └── InfinispanJCacheTest.java ├── kubernetes │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── org │ │ └── infinispan │ │ └── tutorial │ │ └── simple │ │ └── kubernetes │ │ └── InfinispanKubernetes.java ├── listeners │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── infinispan │ │ │ └── tutorial │ │ │ └── simple │ │ │ └── listen │ │ │ └── InfinispanListen.java │ │ └── test │ │ └── java │ │ └── org │ │ └── infinispan │ │ └── tutorial │ │ └── simple │ │ └── listen │ │ └── InfinispanListenTest.java ├── lock │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── infinispan │ │ │ └── tutorial │ │ │ └── simple │ │ │ └── lock │ │ │ └── InfinispanClusteredLock.java │ │ └── test │ │ └── java │ │ └── org │ │ └── infinispan │ │ └── tutorial │ │ └── simple │ │ └── lock │ │ └── InfinispanClusteredLockTest.java ├── map │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── infinispan │ │ │ └── tutorial │ │ │ └── simple │ │ │ └── map │ │ │ └── InfinispanMap.java │ │ └── test │ │ └── java │ │ └── org │ │ └── infinispan │ │ └── tutorial │ │ └── simple │ │ └── map │ │ └── InfinispanMapTest.java ├── multimap │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── infinispan │ │ │ └── tutorial │ │ │ └── simple │ │ │ └── multimap │ │ │ └── InfinispanMultimap.java │ │ └── test │ │ └── java │ │ └── org │ │ └── infinispan │ │ └── tutorial │ │ └── simple │ │ └── multimap │ │ └── InfinispanMultimapTest.java ├── query │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── infinispan │ │ │ └── tutorial │ │ │ └── simple │ │ │ └── query │ │ │ ├── InfinispanQuery.java │ │ │ └── Person.java │ │ └── test │ │ └── java │ │ └── org │ │ └── infinispan │ │ └── tutorial │ │ └── simple │ │ └── query │ │ └── InfinispanQueryTest.java ├── streams │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── infinispan │ │ │ └── tutorial │ │ │ └── simple │ │ │ └── streams │ │ │ └── InfinispanStreams.java │ │ └── test │ │ └── java │ │ └── org │ │ └── infinispan │ │ └── tutorial │ │ └── simple │ │ └── streams │ │ └── InfinispanStreamsTest.java └── transactions │ ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ ├── main │ └── java │ │ └── org │ │ └── infinispan │ │ └── tutorial │ │ └── simple │ │ └── tx │ │ └── InfinispanTx.java │ └── test │ └── java │ └── org │ └── infinispan │ └── tutorial │ └── simple │ └── tx │ └── InfinispanTxTest.java ├── infinispan-remote ├── cache-admin-api │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── infinispan │ │ │ │ └── tutorial │ │ │ │ └── simple │ │ │ │ └── remote │ │ │ │ └── admin │ │ │ │ └── InfinispanRemoteAdminCache.java │ │ └── resources │ │ │ ├── CacheWithXMLConfiguration.xml │ │ │ └── cacheTemplate.xml │ │ └── test │ │ └── java │ │ └── org │ │ └── infinispan │ │ └── tutorial │ │ └── simple │ │ └── remote │ │ └── admin │ │ └── InfinispanRemoteAdminCacheTest.java ├── cache-alias │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── infinispan │ │ │ └── tutorial │ │ │ └── simple │ │ │ └── alias │ │ │ └── InfinispanCacheAlias.java │ │ └── test │ │ └── java │ │ └── org │ │ └── infinispan │ │ └── tutorial │ │ └── simple │ │ └── alias │ │ └── InfinispanCacheAliasTest.java ├── cache │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── infinispan │ │ │ └── tutorial │ │ │ └── simple │ │ │ └── remote │ │ │ └── InfinispanRemoteCache.java │ │ └── test │ │ └── java │ │ └── org │ │ └── infinispan │ │ └── tutorial │ │ └── simple │ │ └── remote │ │ └── InfinispanRemoteCacheTest.java ├── connect-to-infinispan-server │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── org │ │ └── infinispan │ │ └── tutorial │ │ └── simple │ │ └── connect │ │ └── TutorialsConnectorHelper.java ├── continuous-query │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── infinispan │ │ │ └── tutorial │ │ │ └── simple │ │ │ └── remote │ │ │ └── query │ │ │ ├── InfinispanRemoteContinuousQuery.java │ │ │ ├── InstaPost.java │ │ │ └── InstaSchema.java │ │ └── test │ │ └── java │ │ └── org │ │ └── infinispan │ │ └── tutorial │ │ └── simple │ │ └── remote │ │ └── query │ │ └── InfinispanRemoteContinuousQueryTest.java ├── counter │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── infinispan │ │ │ └── tutorial │ │ │ └── simple │ │ │ └── remote │ │ │ └── counter │ │ │ └── InfinispanRemoteCounter.java │ │ └── test │ │ └── java │ │ └── org │ │ └── infinispan │ │ └── tutorial │ │ └── simple │ │ └── remote │ │ └── counter │ │ └── InfinispanRemoteCounterTest.java ├── cross-site-replication │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── docker-compose │ │ ├── create-data.sh │ │ ├── docker-compose.yaml │ │ ├── ny-backup-xsiteCache.xml │ │ └── xsiteCache.xml │ ├── minikube │ │ ├── LON.yaml │ │ ├── NYC.yaml │ │ ├── cache_lon.yaml │ │ ├── cache_nyc.yaml │ │ ├── create-data.sh │ │ ├── identities_lon.yaml │ │ ├── identities_nyc.yaml │ │ └── setup.sh │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── infinispan │ │ │ └── tutorial │ │ │ └── simple │ │ │ └── remote │ │ │ └── xsite │ │ │ └── InfinispanRemoteSwitchCluster.java │ │ └── test │ │ └── java │ │ └── org │ │ └── infinispan │ │ └── tutorial │ │ └── simple │ │ └── remote │ │ └── xsite │ │ └── InfinispanRemoteSwitchClusterTest.java ├── encoding │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── infinispan │ │ │ │ └── tutorial │ │ │ │ └── simple │ │ │ │ └── encoding │ │ │ │ └── InfinispanEncodingCaches.java │ │ └── resources │ │ │ ├── jsonCache.xml │ │ │ ├── textCache.xml │ │ │ └── xmlCache.xml │ │ └── test │ │ └── java │ │ └── org │ │ └── infinispan │ │ └── tutorial │ │ └── simple │ │ └── encoding │ │ └── InfinispanEncodingCachesTest.java ├── infinispan-secured-keycloak │ ├── docker-compose-no-linux.yaml │ ├── docker-compose.yaml │ ├── infinispan-keycloak-realm.json │ ├── infinispan-token-realm-no-linux.yaml │ └── infinispan-token-realm.yaml ├── junit5 │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── infinispan │ │ │ └── tutorial │ │ │ └── simple │ │ │ └── remote │ │ │ └── junit5 │ │ │ └── CachingService.java │ │ └── test │ │ └── java │ │ └── org │ │ └── infinispan │ │ └── tutorial │ │ └── simple │ │ └── remote │ │ └── junit5 │ │ └── CachingServiceTest.java ├── listeners │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── infinispan │ │ │ └── tutorial │ │ │ └── simple │ │ │ └── remote │ │ │ └── listen │ │ │ └── InfinispanRemoteListen.java │ │ └── test │ │ └── java │ │ └── org │ │ └── infinispan │ │ └── tutorial │ │ └── simple │ │ └── remote │ │ └── listen │ │ └── InfinispanRemoteListenTest.java ├── multimap │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── infinispan │ │ │ └── tutorial │ │ │ └── simple │ │ │ └── remote │ │ │ └── multimap │ │ │ └── InfinispanRemoteMultimap.java │ │ └── test │ │ └── java │ │ └── org │ │ └── infinispan │ │ └── tutorial │ │ └── simple │ │ └── remote │ │ └── multimap │ │ └── InfinispanRemoteMultimapTest.java ├── near-cache │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── infinispan │ │ │ └── tutorial │ │ │ └── simple │ │ │ └── nearcache │ │ │ └── InfinispanNearCache.java │ │ └── test │ │ └── java │ │ └── org │ │ └── infinispan │ │ └── tutorial │ │ └── simple │ │ └── nearcache │ │ └── InfinispanNearCacheTest.java ├── opentelemetry │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── docker-compose │ │ ├── docker-compose.yaml │ │ └── infinispan-tracing-configuration-server.yaml │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── org │ │ └── infinispan │ │ └── tutorial │ │ └── simple │ │ └── remote │ │ └── opentelemetry │ │ └── InfinispanRemoteOpenTelemetry.java ├── operator │ ├── minikube │ │ ├── Makefile │ │ ├── README.md │ │ ├── build.sh │ │ ├── deploy.sh │ │ ├── run.sh │ │ └── test.sh │ └── openshift │ │ ├── Makefile │ │ └── README.md ├── per-cache-configuration │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── infinispan │ │ │ │ └── tutorial │ │ │ │ └── simple │ │ │ │ └── remote │ │ │ │ └── percache │ │ │ │ └── InfinispanRemotePerCache.java │ │ └── resources │ │ │ └── cacheConfig.xml │ │ └── test │ │ └── java │ │ └── org │ │ └── infinispan │ │ └── tutorial │ │ └── simple │ │ └── remote │ │ └── percache │ │ └── InfinispanRemotePerCacheTest.java ├── persistence │ ├── README.md │ └── sql-store │ │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ │ ├── mvnw │ │ ├── mvnw.cmd │ │ ├── pom.xml │ │ └── src │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── infinispan │ │ │ │ └── tutorial │ │ │ │ └── simple │ │ │ │ └── remote │ │ │ │ └── persistence │ │ │ │ ├── Author.java │ │ │ │ ├── Book.java │ │ │ │ ├── DBCreator.java │ │ │ │ ├── ProtostreamSchemaUploader.java │ │ │ │ ├── SQLStoreLibraryMain.java │ │ │ │ └── TechLibrarySchema.java │ │ └── resources │ │ │ ├── initDB.sql │ │ │ ├── populateDB.sql │ │ │ ├── sqlQueryCache.xml │ │ │ └── sqlTableCache.xml │ │ └── test │ │ └── java │ │ └── org │ │ └── infinispan │ │ └── tutorial │ │ └── simple │ │ └── remote │ │ └── persistence │ │ └── DBCreatorTest.java ├── programmatic-protostream-marshalling │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── infinispan │ │ │ └── tutorial │ │ │ └── simple │ │ │ └── remote │ │ │ └── marshalling │ │ │ ├── InfinispanProgrammaticProtostreamMarshalling.java │ │ │ ├── Magazine.java │ │ │ ├── MagazineMarshaller.java │ │ │ └── MagazineSchemaCreator.java │ │ └── test │ │ └── java │ │ └── org │ │ └── infinispan │ │ └── tutorial │ │ └── simple │ │ └── remote │ │ └── marshalling │ │ └── InfinispanProgrammaticProtostreamMarshallingTest.java ├── query │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── infinispan │ │ │ │ └── tutorial │ │ │ │ └── simple │ │ │ │ └── remote │ │ │ │ └── query │ │ │ │ ├── InfinispanRemoteQuery.java │ │ │ │ ├── Person.java │ │ │ │ ├── PersonKey.java │ │ │ │ └── TutorialSchema.java │ │ └── resources │ │ │ └── indexedCache.xml │ │ └── test │ │ └── java │ │ └── org │ │ └── infinispan │ │ └── tutorial │ │ └── simple │ │ └── remote │ │ └── query │ │ └── InfinispanRemoteQueryTest.java ├── reactive-api │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── infinispan │ │ │ └── tutorial │ │ │ └── simple │ │ │ └── reactive │ │ │ └── InfinispanReactiveApi.java │ │ └── test │ │ └── java │ │ └── org │ │ └── infinispan │ │ └── tutorial │ │ └── simple │ │ └── reactive │ │ └── InfinispanReactiveApiTest.java ├── redis-client │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── infinispan │ │ │ └── tutorial │ │ │ └── simple │ │ │ └── redis │ │ │ └── RedisClientCache.java │ │ └── test │ │ └── java │ │ └── org │ │ └── infinispan │ │ └── tutorial │ │ └── simple │ │ └── redis │ │ └── RedisClientCacheTest.java ├── security │ ├── secured-cache │ │ ├── .mvn │ │ │ └── wrapper │ │ │ │ ├── maven-wrapper.jar │ │ │ │ └── maven-wrapper.properties │ │ ├── mvnw │ │ ├── mvnw.cmd │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ ├── java │ │ │ │ └── org │ │ │ │ │ └── infinispan │ │ │ │ │ └── tutorial │ │ │ │ │ └── simple │ │ │ │ │ └── remote │ │ │ │ │ └── InfinispanAuthorizationCache.java │ │ │ └── resources │ │ │ │ └── securedCache.xml │ │ │ └── test │ │ │ └── java │ │ │ └── org │ │ │ └── infinispan │ │ │ └── tutorial │ │ │ └── simple │ │ │ └── remote │ │ │ └── InfinispanAuthorizationCacheTest.java │ └── tls-authorization │ │ ├── .gitignore │ │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ │ ├── README.adoc │ │ ├── clean_certs.sh │ │ ├── create_signed_certificates.sh │ │ ├── create_signed_server_truststore_auth.sh │ │ ├── create_unsigned_certificates.sh │ │ ├── mvnw │ │ ├── mvnw.cmd │ │ ├── pom.xml │ │ ├── server │ │ ├── infinispan-sCert.xml │ │ ├── infinispan-sCertAuth.xml │ │ ├── infinispan-uCert.xml │ │ └── infinispan-uCertAuth.xml │ │ └── src │ │ └── main │ │ └── java │ │ └── org │ │ └── infinispan │ │ └── tutorial │ │ └── simple │ │ └── security │ │ └── tls │ │ ├── InfinispanTlsConnection.java │ │ └── SSLConfig.java ├── spatial-queries │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── infinispan │ │ │ │ └── tutorial │ │ │ │ └── simple │ │ │ │ └── remote │ │ │ │ └── spatial │ │ │ │ ├── Hiking.java │ │ │ │ ├── InfinispanSpatialQueries.java │ │ │ │ ├── Restaurant.java │ │ │ │ ├── TrainRoute.java │ │ │ │ └── TutorialSchema.java │ │ └── resources │ │ │ └── indexedCache.xml │ │ └── test │ │ └── java │ │ └── org │ │ └── infinispan │ │ └── tutorial │ │ └── simple │ │ └── remote │ │ └── spatial │ │ └── InfinispanSpatialQueriesTest.java ├── tasks │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── org │ │ │ └── infinispan │ │ │ └── tutorial │ │ │ └── simple │ │ │ └── server │ │ │ └── tasks │ │ │ └── InfinispanServerTasks.java │ │ └── resources │ │ └── hello.js └── transactions │ ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── infinispan │ │ │ └── tutorial │ │ │ └── simple │ │ │ └── remote │ │ │ └── transaction │ │ │ └── InfinispanRemoteTx.java │ └── resources │ │ └── simple-tx-cache.xml │ └── test │ └── java │ └── org │ └── infinispan │ └── tutorial │ └── simple │ └── remote │ └── transaction │ └── InfinispanRemoteTxTest.java ├── integrations ├── hibernate │ ├── local │ │ ├── .mvn │ │ │ └── wrapper │ │ │ │ ├── maven-wrapper.jar │ │ │ │ └── maven-wrapper.properties │ │ ├── mvnw │ │ ├── mvnw.cmd │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ ├── java │ │ │ └── org │ │ │ │ └── infinispan │ │ │ │ └── tutorial │ │ │ │ └── simple │ │ │ │ └── hibernate │ │ │ │ └── cache │ │ │ │ └── local │ │ │ │ ├── InfinispanHibernateCacheLocal.java │ │ │ │ └── model │ │ │ │ ├── Event.java │ │ │ │ └── Person.java │ │ │ └── resources │ │ │ ├── META-INF │ │ │ └── persistence.xml │ │ │ └── log4j2-tutorial.xml │ ├── spring-local │ │ ├── .mvn │ │ │ └── wrapper │ │ │ │ ├── maven-wrapper.jar │ │ │ │ └── maven-wrapper.properties │ │ ├── mvnw │ │ ├── mvnw.cmd │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ ├── java │ │ │ └── org │ │ │ │ └── infinispan │ │ │ │ └── tutorial │ │ │ │ └── simple │ │ │ │ └── hibernate │ │ │ │ └── cache │ │ │ │ └── spring │ │ │ │ └── local │ │ │ │ ├── InfinispanHibernateCacheSpringLocal.java │ │ │ │ └── model │ │ │ │ ├── Event.java │ │ │ │ └── Person.java │ │ │ └── resources │ │ │ └── application.properties │ └── wildfly-local │ │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ │ ├── mvnw │ │ ├── mvnw.cmd │ │ ├── pom.xml │ │ └── src │ │ └── main │ │ ├── java │ │ └── org │ │ │ └── infinispan │ │ │ └── tutorial │ │ │ └── simple │ │ │ └── hibernate │ │ │ └── cache │ │ │ └── wildfly │ │ │ └── local │ │ │ ├── InfinispanHibernateCacheWildflyLocal.java │ │ │ ├── controller │ │ │ └── PersistenceManager.java │ │ │ ├── model │ │ │ ├── Event.java │ │ │ └── Person.java │ │ │ └── util │ │ │ ├── ClearStatistics.java │ │ │ └── Resources.java │ │ ├── resources │ │ └── META-INF │ │ │ └── persistence.xml │ │ └── webapp │ │ └── WEB-INF │ │ ├── beans.xml │ │ └── web.xml ├── spring-boot │ ├── cache-embedded │ │ ├── .mvn │ │ │ └── wrapper │ │ │ │ ├── maven-wrapper.jar │ │ │ │ └── maven-wrapper.properties │ │ ├── mvnw │ │ ├── mvnw.cmd │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ ├── java │ │ │ └── org │ │ │ │ └── infinispan │ │ │ │ └── tutorial │ │ │ │ └── simple │ │ │ │ └── spring │ │ │ │ └── embedded │ │ │ │ ├── BasqueName.java │ │ │ │ ├── BasqueNamesCachingApp.java │ │ │ │ ├── BasqueNamesRepository.java │ │ │ │ ├── Data.java │ │ │ │ └── Reader.java │ │ │ └── resources │ │ │ ├── application.properties │ │ │ └── infinispan.xml │ ├── cache-remote-reactor │ │ ├── .mvn │ │ │ └── wrapper │ │ │ │ ├── maven-wrapper.jar │ │ │ │ └── maven-wrapper.properties │ │ ├── mvnw │ │ ├── mvnw.cmd │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ ├── java │ │ │ └── org │ │ │ │ └── infinispan │ │ │ │ └── tutorial │ │ │ │ └── simple │ │ │ │ └── spring │ │ │ │ └── remote │ │ │ │ ├── BasqueName.java │ │ │ │ ├── BasqueNamesCachingApp.java │ │ │ │ ├── BasqueNamesRepository.java │ │ │ │ ├── BasquesNamesSchemaBuilder.java │ │ │ │ ├── Data.java │ │ │ │ ├── InfinispanConfiguration.java │ │ │ │ └── Reader.java │ │ │ └── resources │ │ │ ├── application.properties │ │ │ └── basquesNamesCache.xml │ ├── cache-remote │ │ ├── .mvn │ │ │ └── wrapper │ │ │ │ ├── maven-wrapper.jar │ │ │ │ └── maven-wrapper.properties │ │ ├── mvnw │ │ ├── mvnw.cmd │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ ├── java │ │ │ └── org │ │ │ │ └── infinispan │ │ │ │ └── tutorial │ │ │ │ └── simple │ │ │ │ └── spring │ │ │ │ └── remote │ │ │ │ ├── BasqueName.java │ │ │ │ ├── BasqueNamesCachingApp.java │ │ │ │ ├── BasqueNamesRepository.java │ │ │ │ ├── BasquesNamesSchemaBuilder.java │ │ │ │ ├── Data.java │ │ │ │ ├── InfinispanConfiguration.java │ │ │ │ └── Reader.java │ │ │ └── resources │ │ │ ├── application.properties │ │ │ └── basquesNamesCache.xml │ ├── prometheus.yml │ ├── session-embedded │ │ ├── .mvn │ │ │ └── wrapper │ │ │ │ ├── maven-wrapper.jar │ │ │ │ └── maven-wrapper.properties │ │ ├── mvnw │ │ ├── mvnw.cmd │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── org │ │ │ └── infinispan │ │ │ └── tutorial │ │ │ └── simple │ │ │ └── spring │ │ │ └── session │ │ │ ├── UserSessionsApp.java │ │ │ └── UserSessionsController.java │ └── session-remote │ │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ │ ├── mvnw │ │ ├── mvnw.cmd │ │ ├── pom.xml │ │ └── src │ │ └── main │ │ ├── java │ │ └── org │ │ │ └── infinispan │ │ │ └── tutorial │ │ │ └── simple │ │ │ └── spring │ │ │ └── session │ │ │ ├── InfinispanConfiguration.java │ │ │ ├── UserSessionsApp.java │ │ │ └── WebController.java │ │ └── resources │ │ ├── application.properties │ │ ├── sessionsCacheConfig.xml │ │ ├── static │ │ ├── favicon.ico │ │ └── images │ │ │ └── logo.png │ │ └── templates │ │ ├── greeting.html │ │ └── index.html └── spring │ └── spring-cache │ ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ └── main │ └── java │ └── org │ └── infinispan │ └── tutorial │ └── simple │ └── spring │ └── embedded │ ├── SpringAnnotationConfiguration.java │ └── SpringCaching.java ├── mvnw ├── mvnw.cmd ├── non-java-clients ├── c# │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Simple.cs │ ├── simple.csproj │ └── simple.sln ├── c++ │ ├── CMakeLists.txt │ └── src │ │ └── simple.cpp └── node.js │ ├── index.js │ ├── package-lock.json │ └── package.json └── pom.xml /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: maven 4 | directory: "/" 5 | schedule: 6 | interval: daily 7 | open-pull-requests-limit: 10 8 | target-branch: main 9 | - package-ecosystem: maven 10 | directory: "/" 11 | schedule: 12 | interval: daily 13 | open-pull-requests-limit: 10 14 | target-branch: development 15 | - package-ecosystem: github-actions 16 | directory: "/" 17 | schedule: 18 | interval: daily 19 | open-pull-requests-limit: 10 -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # ignore .svn metadata files 2 | .svn 3 | # ignore Maven generated target folders 4 | target 5 | *.protobin 6 | # ignore Maven shade generated files 7 | dependency-reduced-pom.xml 8 | # ignore eclipse files 9 | .project 10 | .classpath 11 | .settings 12 | .scala_dependencies 13 | .externalToolBuilders 14 | .factorypath 15 | .cache-main 16 | .cache-tests 17 | # ignore IDEA files 18 | *.iml 19 | *.ipr 20 | *.iws 21 | .idea 22 | atlassian-ide-plugin.xml 23 | maven-ant-tasks.jar 24 | test-output 25 | classes 26 | # log files 27 | *.log 28 | # vim files 29 | *.swp 30 | # buffered files generated by editors ending in ~ 31 | *~ 32 | # testsuite generated files/folders 33 | PutObjectStoreDirHere 34 | /query/person 35 | ObjectStore 36 | .cache 37 | # Compiled python files 38 | *.pyc 39 | # Jandex generated indexes 40 | *.idx 41 | # Persisted metadata 42 | *.dat 43 | # Antlr-generated 44 | IspnCliQLLexer.java 45 | IspnCliQLParser.java 46 | IspnCliQL.tokens 47 | # OS X generated file 48 | .DS_Store 49 | # Checkstlye in Eclipse 50 | .checkstyle 51 | # Native build 52 | build 53 | # node.js dependency directory 54 | # https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git 55 | node_modules 56 | # OpenShift 57 | openshift.local.clusterup 58 | non-java-clients/node.js/package-lock.json 59 | /documentation/asciidoc/titles/simple_tutorials.html 60 | infinispan-server-* 61 | library.* 62 | -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 3 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing guide 2 | 3 | **Want to contribute to simple tutorials? That's great!** 4 | 5 | We try to make it easy, and all contributions, even the smaller ones, are more than welcome. 6 | This includes bug reports, fixes, documentation, new tutorials... 7 | 8 | But first, please read this page. 9 | 10 | ## Reporting an issue 11 | 12 | This project uses JIRA issues to manage the issues, but feel free to create an issue in this repository and 13 | we will handle the JIRA lifecycle. 14 | 15 | ## Before you contribute and structure of the repository 16 | 17 | To contribute, use GitHub Pull Requests, from your **own** fork. 18 | 19 | * The `main` branch uses the latest release of Infinispan (development or final version) 20 | * The `x.x.x` branch uses the latest stable release corresponding the name of the branch. 21 | 22 | All contributions must target the `main` branch. 23 | 24 | ### Code reviews 25 | 26 | All submissions, including submissions by project members, need to be reviewed before being merged. 27 | 28 | ### Continuous Integration 29 | 30 | Because we are all humans, the project use a continuous integration approach and each pull request triggers a full build. 31 | Please make sure to monitor the output of the build and act accordingly. 32 | 33 | ### Documentation is not optional 34 | 35 | The documentation under documentation must be updated accordingly. 36 | 37 | ## Build with Maven 38 | 39 | * Clone the repository: `git clone https://github.com/infinispan/infinispan-simple-tutorials.git` 40 | * Navigate to the directory: `cd infinispan-simple-tutorials` 41 | * Invoke `mvn clean package` from the root directory 42 | 43 | Thanks!! :) 44 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Infinispan Simple Tutorials 2 | 3 | This is a collection of simple tutorials that explain how to use certain 4 | features of Infinispan in the most straightforward way possible. 5 | 6 | Check the documentation in the [Infinispan website](https://infinispan.org/tutorials/simple/simple_tutorials.html) 7 | 8 | ## To go further 9 | Check [Infinispan Demos](https://github.com/infinispan-demos/links) repository 10 | -------------------------------------------------------------------------------- /documentation/asciidoc/stories/assembly_embedded_tutorials.adoc: -------------------------------------------------------------------------------- 1 | [id='embedded-tutorials'] 2 | :context: embedded-cache-tutorials 3 | = Embedded caches 4 | 5 | Add {brandname} as a dependency to your Java project and use embedded caches that increase application performance and give you capabilities to handle complex use cases. 6 | 7 | include::{topics}/ref_embedded_tutorials.adoc[leveloffset=+1] 8 | include::{topics}/ref_embedded_kubernetes_tutorial.adoc[leveloffset=+1] 9 | 10 | // Restore the parent context. 11 | ifdef::parent-context[:context: {parent-context}] 12 | ifndef::parent-context[:!context:] 13 | -------------------------------------------------------------------------------- /documentation/asciidoc/stories/assembly_hibernate_tutorials.adoc: -------------------------------------------------------------------------------- 1 | [id='hibernate-tutorials'] 2 | :context: hibernate-tutorials 3 | = Hibernate 4 | 5 | include::{topics}/ref_hibernate_tutorials.adoc[leveloffset=+1] 6 | 7 | // Restore the parent context. 8 | ifdef::parent-context[:context: {parent-context}] 9 | ifndef::parent-context[:!context:] 10 | -------------------------------------------------------------------------------- /documentation/asciidoc/stories/assembly_remote_tutorials.adoc: -------------------------------------------------------------------------------- 1 | [id='remote-tutorials'] 2 | :context: remote-cache-tutorials 3 | = Remote caches 4 | 5 | Deploy multiple {brandname} Server instances to create remote cache clusters that give you a fault-tolerant and scalable data tier with high-speed access from Hot Rod and REST clients. 6 | 7 | include::{topics}/ref_remote_tutorials.adoc[leveloffset=+1] 8 | include::{topics}/ref_hotrod_java_tutorials.adoc[leveloffset=+1] 9 | ifdef::community[] 10 | include::{topics}/ref_hotrod_js_tutorials.adoc[leveloffset=+1] 11 | include::{topics}/ref_hotrod_dotnet_tutorials.adoc[leveloffset=+1] 12 | include::{topics}/ref_hotrod_cpp_tutorials.adoc[leveloffset=+1] 13 | include::{topics}/ref_cross_site_replication.adoc[leveloffset=+1] 14 | include::{topics}/ref_secured_with_token_keycloak.adoc[leveloffset=+1] 15 | include::{topics}/ref_tracing_opentelemetry.adoc[leveloffset=+1] 16 | endif::community[] 17 | 18 | // Restore the parent context. 19 | ifdef::parent-context[:context: {parent-context}] 20 | ifndef::parent-context[:!context:] 21 | -------------------------------------------------------------------------------- /documentation/asciidoc/stories/assembly_spring_tutorials.adoc: -------------------------------------------------------------------------------- 1 | [id='spring-tutorials'] 2 | :context: spring-tutorials 3 | = Spring and Spring Boot 4 | 5 | include::{topics}/ref_spring_tutorials.adoc[leveloffset=+1] 6 | 7 | // Restore the parent context. 8 | ifdef::parent-context[:context: {parent-context}] 9 | ifndef::parent-context[:!context:] 10 | -------------------------------------------------------------------------------- /documentation/asciidoc/titles/simple_tutorials.asciidoc: -------------------------------------------------------------------------------- 1 | //Directory attributes 2 | :stories: ../stories 3 | :topics: ../topics 4 | 5 | //Doc attributes 6 | //Community 7 | :community: 8 | include::{topics}/attributes/community-attributes.adoc[] 9 | //Downstream 10 | //include::{topics}/attributes/downstream-attributes.adoc[] 11 | //:downstream: 12 | //Maven commands 13 | include::{topics}/attributes/mvn_commands.adoc[] 14 | 15 | //Title attributes 16 | :toc2: 17 | :icons: font 18 | :toclevels: 3 19 | :numbered: 20 | :sectanchors: 21 | 22 | //Title 23 | = {brandname} {tutorials} 24 | 25 | Run these code examples that demonstrate {brandname} capabilities and show you how to start using {brandname} caches with your applications. 26 | 27 | [preface] 28 | include::{topics}/proc_building_and_running.adoc[leveloffset=+1] 29 | 30 | //User stories 31 | include::stories.adoc[] 32 | -------------------------------------------------------------------------------- /documentation/asciidoc/titles/stories.adoc: -------------------------------------------------------------------------------- 1 | //Reference user stories or topics. 2 | //Please review authoring guidelines in the Contributors Guide. 3 | 4 | include::{stories}/assembly_embedded_tutorials.adoc[leveloffset=+1] 5 | include::{stories}/assembly_remote_tutorials.adoc[leveloffset=+1] 6 | include::{stories}/assembly_spring_tutorials.adoc[leveloffset=+1] 7 | include::{stories}/assembly_hibernate_tutorials.adoc[leveloffset=+1] 8 | -------------------------------------------------------------------------------- /documentation/asciidoc/topics/attributes/downstream-attributes.adoc: -------------------------------------------------------------------------------- 1 | :tutorials: Code Tutorials 2 | :repository: https://github.com/redhat-developer/redhat-datagrid-tutorials/tree/RHDG_8.4.0 3 | :repository_ssh: git@github.com:redhat-developer/redhat-datagrid-tutorials.git 4 | -------------------------------------------------------------------------------- /documentation/asciidoc/topics/attributes/mvn_commands.adoc: -------------------------------------------------------------------------------- 1 | //Community content 2 | ifdef::community[] 3 | :clean_package: ./mvnw clean package 4 | :exec_exec: ./mvnw exec:exec 5 | :exec_run: ./mvnw exec:exec@run 6 | :clean_exec: ./mvnw clean package exec:exec 7 | :clean_install: ./mvnw clean install -DskipTests=true 8 | :package_exec: ./mvnw package exec:exec 9 | :wildfly_deploy: ./mvnw wildfly:deploy 10 | :spring_boot_run: ./mvnw spring-boot:run 11 | endif::community[] 12 | //Downstream content 13 | ifdef::downstream[] 14 | :clean_package: ./mvnw -s /path/to/maven-settings.xml clean package 15 | :exec_exec: ./mvnw -s /path/to/maven-settings.xml exec:exec 16 | :exec_run: ./mvnw -s /path/to/maven-settings.xml exec:exec@run 17 | :clean_exec: ./mvnw -s /path/to/maven-settings.xml clean package exec:exec 18 | :clean_install: ./mvnw -s /path/to/maven-settings.xml clean install -DskipTests=true 19 | :package_exec: ./mvnw -s /path/to/maven-settings.xml package exec:exec 20 | :wildfly_deploy: ./mvnw -s /path/to/maven-settings.xml wildfly:deploy 21 | :spring_boot_run: ./mvnw -s /path/to/maven-settings.xml spring-boot:run 22 | endif::downstream[] 23 | -------------------------------------------------------------------------------- /documentation/asciidoc/topics/proc_building_and_running.adoc: -------------------------------------------------------------------------------- 1 | [id='building-and-running_{context}'] 2 | = Building and running the tutorials 3 | Install the required Java and Maven versions before you build and run {brandname} {tutorials}. 4 | 5 | .Java 6 | 7 | * {brandname} requires Java 17 as the minimum version. 8 | 9 | .Maven 10 | 11 | To build the tutorials you must use https://maven.apache.org/[Maven] 3.x or greater. 12 | 13 | .Procedure 14 | 15 | . Clone the link:{repository}[{brandname} {tutorials}] repository. 16 | + 17 | [source,bash,options="nowrap",subs=attributes+] 18 | ---- 19 | $ git clone {repository_ssh} 20 | ---- 21 | 22 | . Run the following command from the root directory: 23 | + 24 | [source,bash,options="nowrap",subs=attributes+] 25 | ---- 26 | $ {clean_install} 27 | ---- 28 | -------------------------------------------------------------------------------- /documentation/asciidoc/topics/ref_embedded_kubernetes_tutorial.adoc: -------------------------------------------------------------------------------- 1 | [id='embedded-kubernetes_tutorial_{context}'] 2 | = Kubernetes and Openshift tutorial 3 | 4 | This tutorial contains instructions on how to run Infinispan library mode (as a microservice) in Kubernetes/OpenShift. 5 | 6 | Prerequisites: Maven and Docker daemon running in the background. 7 | 8 | [discrete] 9 | == Prerequisites 10 | 11 | - A running Openshift or Kubernetes cluster 12 | 13 | [discrete] 14 | == Building the tutorial 15 | 16 | This tutorial is built using the maven command: 17 | 18 | [source,bash] 19 | ---- 20 | ./mvnw package 21 | ---- 22 | 23 | Note that `target/` directory contains additional directories like `docker` (with generated Dockerfile) and `classes/META-INF/jkube` with Kubernetes and OpenShift deployment templates. 24 | 25 | TIP: If the Docker Daemon is down, the build will omit processing Dockerfiles. Use `docker` profile to turn it on manually. 26 | 27 | [discrete] 28 | == Deploying the tutorial to Kubernetes 29 | 30 | This is handle by the JKube maven plugin, just invoke: 31 | 32 | [source,bash] 33 | ---- 34 | mvn k8s:build k8s:push k8s:resource k8s:apply -Doptions.image= # <1> 35 | ---- 36 | <1> `IMAGE_NAME` must be replaced with the FQN of the container to deploy to Kubernetes. This container must be created 37 | in a repository that you have permissions to push to and is accessible from within your Kubernetes cluster. 38 | 39 | [discrete] 40 | == Viewing and scaling up 41 | 42 | Everything should be up and running at this point. Now login into the OpenShift or Kubernetes cluster and scale the application 43 | 44 | [source,bash] 45 | ---- 46 | kubectl scale --replicas=3 deployment/$(kubectl get rs --namespace=myproject | grep infinispan | awk '{print $1}') --namespace=myproject 47 | ---- 48 | 49 | [discrete] 50 | == Undeploying the tutorial 51 | 52 | This is handled by the JKube maven plugin, just invoke: 53 | 54 | ``` 55 | mvn k8s:undeploy 56 | ``` -------------------------------------------------------------------------------- /documentation/asciidoc/topics/ref_hibernate_tutorials.adoc: -------------------------------------------------------------------------------- 1 | [id='hibernate-tutorials_{context}'] 2 | = Hibernate tutorials 3 | 4 | You can run these tutorials directly in your IDE or from the command line as follows: 5 | 6 | [source,bash,options="nowrap",subs=attributes+] 7 | ---- 8 | $ {clean_package} 9 | $ {exec_exec} 10 | ---- 11 | 12 | Tutorials that involve deploying an archive to Wildfly are first deployed like this: 13 | 14 | [source,bash,options="nowrap",subs=attributes+] 15 | ---- 16 | $ {clean_package} 17 | $ {wildfly_deploy} 18 | ---- 19 | 20 | [%header,cols=2*] 21 | |=== 22 | |Tutorial link 23 | |Description 24 | 25 | |link:{repository}/integrations/hibernate/local[Hibernate local] 26 | |Demonstrates how {brandname} Embedded and Hibernate work. 27 | 28 | |link:{repository}/integrations/hibernate/spring-local[Hibernate and Spring local] 29 | |Demonstrates how Spring, Hibernate and {brandname} work. 30 | 31 | |link:{repository}/integrations/hibernate/wildfly-local[Hibernate and WildFly local] 32 | |Demonstrates how Wildfly and {brandname} work. 33 | 34 | |=== 35 | 36 | [discrete] 37 | == {brandname} documentation 38 | 39 | You can find more resources in our documentation at: 40 | 41 | * link:{library_docs}#ispn_modules[{brandname} WildFly modules] 42 | * link:{hibernate_docs}[Hibernate Second-Level Caching] 43 | -------------------------------------------------------------------------------- /documentation/asciidoc/topics/ref_hotrod_cpp_tutorials.adoc: -------------------------------------------------------------------------------- 1 | [id='hotrod-cpp-tutorials_{context}'] 2 | = Hot Rod C{plusplus} client tutorials 3 | 4 | [discrete] 5 | == Prerequisites 6 | 7 | * Centos 7 (RHEL 7 should work also) 8 | * {brandname} Server running with the default standalone configuration 9 | 10 | [discrete] 11 | == Docker 12 | Here is a easy way to setup a Docker container running Centos 7, so you can run the 13 | tutorial in a confined environment. 14 | 15 | [discrete] 16 | === Setup the Server 17 | 18 | On the host machine, start at least one {brandname} Server instance. 19 | 20 | Create a default cache 21 | 22 | curl -vvvv -X POST http://127.0.0.1:11222/rest/v2/caches/default 23 | 24 | Change to this README directory, download the client .rpm 25 | 26 | wget https://downloads.jboss.org/infinispan/HotRodCPP/8.3.1.Final/infinispan-hotrod-cpp-8.3.1.Final-RHEL-x86_64.rpm 27 | Start the Centos Docker container 28 | 29 | docker run -i -t -v $PWD:/home/infinispan/git/infinispan-simple-tutorial:Z --network="host" centos:7 30 | 31 | [discrete] 32 | === On the Container 33 | 34 | [discrete] 35 | ==== Build the client 36 | cd /home/infinispan/git/infinispan-simple-tutorial/c++ 37 | yum install wget unzip cmake make gcc-c++ protobuf-devel cyrus-sasl-devel 38 | rpm -i --force infinispan-hotrod-cpp-8.3.1.Final-RHEL-x86_64.rpm 39 | mkdir build && pushd build 40 | cmake .. 41 | cmake --build . 42 | 43 | [discrete] 44 | ==== Run the client 45 | LD_LIBRARY_PATH=/usr/lib ./simple 46 | -------------------------------------------------------------------------------- /documentation/asciidoc/topics/ref_hotrod_dotnet_tutorials.adoc: -------------------------------------------------------------------------------- 1 | [id='hotrod-dotnet-tutorials_{context}'] 2 | = Hot Rod .NET/C# client tutorials 3 | 4 | [discrete] 5 | == Prerequisites 6 | 7 | * .NET C# Client assembly. You can get it either: 8 | ** from source https://github.com/infinispan/dotnet-client 9 | ** from install pack http://infinispan.org/hotrod-clients/ 10 | 11 | [discrete] 12 | == Running the example 13 | Do one of the following (1,2 may be suitable for devs while 3 is for runtime): 14 | 15 | . Copy in this directory (aside this README.md) the following dlls: 16 | - hotrodcs.dll 17 | - hotrod.dll 18 | - hotrod_wrap.dll 19 | - libeay32.dll (SSL stuff) 20 | - ssleay32.dll (SSL stuff) 21 | 22 | . Update dlls location in simple.csproj with the right paths in your file system 23 | 24 | . Install the binary client on the machine, update the PATH env. variable to include the bin and lib directories of the installed pack, install your application. 25 | 26 | [TIP] 27 | ==== 28 | HINT THAT CAN SAVE YOU A LOT OF TIME: the .csproj at build time will copy the dlls into the output directory aside the application, 29 | this is the simplest way to run the example without changing your setting (PATH variable). 30 | As a general rule remember that the unmanaged libraries (hotrod_wrap, hotrod, libeay32, libssl32) 31 | must be either in the PATH or in the application working directory. 32 | ==== 33 | -------------------------------------------------------------------------------- /documentation/asciidoc/topics/ref_hotrod_js_tutorials.adoc: -------------------------------------------------------------------------------- 1 | [id='hotrod-js-tutorials_{context}'] 2 | = Hot Rod Node.JS client tutorials 3 | 4 | [discrete] 5 | == Prerequisites 6 | 7 | * Node.js 12 or 14 8 | 9 | .Build 10 | [source,bash] 11 | ---- 12 | npm install 13 | ---- 14 | 15 | [discrete] 16 | == Running the example 17 | 18 | Create a cache named `my-cache` using the http://localhost:11222/[{brandname} Console]. 19 | 20 | 21 | .'my-cache' cache configuration 22 | [source,json] 23 | ---- 24 | "distributed-cache": { 25 | "mode": "SYNC", 26 | "encoding": { 27 | "media-type": "text/plain" 28 | }, 29 | "statistics": true 30 | } 31 | ---- 32 | 33 | .Execution 34 | [source,bash] 35 | ---- 36 | node index.js 37 | ---- 38 | 39 | Check with the {brandname} Console http://localhost:11222/console/my-cach[the `my-cache` cache detail]. 40 | -------------------------------------------------------------------------------- /documentation/asciidoc/topics/ref_remote_tutorials.adoc: -------------------------------------------------------------------------------- 1 | [id='remote-tutorials_{context}'] 2 | = Remote cache tutorials 3 | 4 | To run these tutorials you need at least one locally running instance of {brandname} Server. 5 | Each tutorial will try to connect to a running server in `localhost:11222` with 6 | `admin/password` credentials. However, if a Docker instance is found, and the server is not running, 7 | tutorials will spin up a local server with `Testcontainers`. 8 | 9 | ifdef::community[] 10 | To run the Server as a container image, visit the "Get Started" page 11 | in the {brandname} Website: 12 | 13 | link:https://infinispan.org/get-started/[Get Started with {brandname}] 14 | endif::community[] 15 | 16 | You can link:{download_url}[download] the distribution and run the following commands: 17 | 18 | [source,bash,options="nowrap",subs=attributes+] 19 | ---- 20 | $ ./bin/cli.sh user create admin -p "password" 21 | $ ./bin/server.sh 22 | ---- 23 | 24 | [NOTE] 25 | ==== 26 | {brandname} Server enables authentication and authorization by default. 27 | Creating a user named `admin` gives you administrative access to {brandname} Server. 28 | ==== 29 | 30 | .Building and running remote cache tutorials 31 | You can build and run remote cache tutorials directly in your IDE or from the command line as follows: 32 | 33 | [source,bash,options="nowrap",subs=attributes+] 34 | ---- 35 | $ {clean_exec} 36 | ---- 37 | -------------------------------------------------------------------------------- /documentation/asciidoc/topics/ref_secured_with_token_keycloak.adoc: -------------------------------------------------------------------------------- 1 | [id='secured_with_token_keycloak_{context}'] 2 | = Token based Security Realm with Keycloak 3 | 4 | Learn how to handle security authentication in {brandname} with Keycloak. 5 | 6 | link:{repository}/infinispan-remote/infinispan-secured-keycloak[Token based security tutorial with Keycloak] 7 | 8 | In this tutorial, you start one {brandname} cluster and Keycloak. 9 | This tutorial demonstrates {brandname} security capabilities locally using `docker-compose`. 10 | 11 | == Docker compose 12 | 13 | [WARNING] 14 | ==== 15 | Make sure you have `docker` and `docker-compose` installed locally. 16 | ==== 17 | 18 | .Steps 19 | 20 | . Run `docker-compose up`. {sso} and {brandname} will start with all the necessary configuration. 21 | 22 | . Access the console at `http://localhost:11222/console`. You should be redirected to Keycloak login. 23 | 24 | . Enter 'admin/adminPassword' credentials in the login page. 25 | 26 | . You are now back in the console, logged in. 27 | 28 | [TIP] 29 | If you are using Docker of Mac or Docker Desktop, `network_mode: host` might still not be supported. 30 | In that case, run `docker-compose -f docker-compose-no-linux.yaml up` and add `127.0.0.1 keycloak` 31 | to `/etc/hosts`. -------------------------------------------------------------------------------- /documentation/asciidoc/topics/ref_spatial_queries.adoc: -------------------------------------------------------------------------------- 1 | [id='spatial_queries_{context}'] 2 | = Spatial queries 3 | 4 | Learn how to use spatial queries. 5 | 6 | link:{repository}/infinispan-remote/spatial-queries[Spatial queries tutorial] 7 | 8 | In this tutorial, you have a demonstration of how to use spatial queries with {brandname}. 9 | 10 | [role="_additional-resources"] 11 | .Additional resources 12 | * link:{spacial_queries_docs}[Spatial queries documentation] 13 | * link:{spatial_queries_blog}[Spatial queries blog] 14 | -------------------------------------------------------------------------------- /documentation/asciidoc/topics/ref_tracing_opentelemetry.adoc: -------------------------------------------------------------------------------- 1 | [id='tracing_{context}'] 2 | = Tracing with OpenTelemetry 3 | 4 | Learn how to set up a server with traces enabled. 5 | 6 | link:{repository}/infinispan-remote/opentelemetry[Tracing and OpenTelemetry tutorial] 7 | 8 | In this tutorial, you start a {brandname} server with tracing enabled. Tracing is done 9 | using Jaeger. 10 | This tutorial demonstrates {brandname} observability capabilities locally using `docker-compose`. 11 | 12 | == Docker compose 13 | 14 | [WARNING] 15 | ==== 16 | Make sure you have `docker` and `docker-compose` or `podman` and `podman-compose` installed locally. 17 | ==== 18 | 19 | .Steps 20 | . Run `docker-compose up`. The docker-compose yaml creates the {brandname} cluster using the `infinispan-tracing-configuration-server.yaml` file that 21 | sets up the tracing configuration. 22 | Access the console of at `http://localhost:11222/console` with admin/password. 23 | . Run the `InfinispanRemoteOpenTelemetry` main class 24 | . Check Jaeger console and visualize the traced spans at `http://localhost:16686/` 25 | 26 | [role="_additional-resources"] 27 | .Additional resources 28 | * link:{observability_docs}[Tracing configuration] 29 | -------------------------------------------------------------------------------- /infinispan-embedded/cache-alias/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/infinispan-embedded/cache-alias/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /infinispan-embedded/cache-alias/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 3 | -------------------------------------------------------------------------------- /infinispan-embedded/cache-alias/src/test/java/org/infinispan/tutorial/simple/alias/InfinispanCacheAliasTest.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.alias; 2 | 3 | import org.junit.jupiter.api.AfterEach; 4 | import org.junit.jupiter.api.BeforeEach; 5 | import org.junit.jupiter.api.Test; 6 | 7 | import static org.infinispan.tutorial.simple.alias.InfinispanCacheAlias.ALIAS_1; 8 | import static org.infinispan.tutorial.simple.alias.InfinispanCacheAlias.ALIAS_2; 9 | import static org.infinispan.tutorial.simple.alias.InfinispanCacheAlias.DIST_CACHE_NAME; 10 | import static org.junit.jupiter.api.Assertions.assertEquals; 11 | import static org.junit.jupiter.api.Assertions.assertNotNull; 12 | import static org.junit.jupiter.api.Assertions.assertNull; 13 | 14 | public class InfinispanCacheAliasTest { 15 | InfinispanCacheAlias infinispanCacheAlias = new InfinispanCacheAlias(); 16 | 17 | @BeforeEach 18 | public void start() { 19 | infinispanCacheAlias.createDefaultCacheManager(); 20 | } 21 | 22 | @AfterEach 23 | public void stop() { 24 | infinispanCacheAlias.stopDefaultCacheManager(); 25 | } 26 | 27 | @Test 28 | public void testCacheAlias() { 29 | assertNotNull(infinispanCacheAlias.cm1); 30 | infinispanCacheAlias.createACacheWithAliasAndPopulate(1); 31 | assertEquals(1, infinispanCacheAlias.cm1.getCache(DIST_CACHE_NAME).size()); 32 | assertEquals(1, infinispanCacheAlias.cm1.getCache(ALIAS_1).size()); 33 | assertNull(infinispanCacheAlias.cm1.getCache(ALIAS_2)); 34 | 35 | infinispanCacheAlias.updateCacheConfigWithSecondAlias(); 36 | 37 | assertEquals(1, infinispanCacheAlias.cm1.getCache(ALIAS_2).size()); 38 | } 39 | } -------------------------------------------------------------------------------- /infinispan-embedded/cache-distributed/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/infinispan-embedded/cache-distributed/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /infinispan-embedded/cache-distributed/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 3 | -------------------------------------------------------------------------------- /infinispan-embedded/cache-distributed/src/test/java/org/infinispan/tutorial/simple/distributed/InfinispanDistributedTest.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.distributed; 2 | import org.junit.jupiter.api.AfterEach; 3 | import org.junit.jupiter.api.BeforeEach; 4 | import org.junit.jupiter.api.Test; 5 | 6 | import static org.infinispan.tutorial.simple.distributed.InfinispanDistributed.DIST_CACHE_NAME; 7 | import static org.junit.jupiter.api.Assertions.assertEquals; 8 | 9 | public class InfinispanDistributedTest { 10 | InfinispanDistributed infinispanDistributed = new InfinispanDistributed(); 11 | 12 | @BeforeEach 13 | public void start() { 14 | infinispanDistributed.createDefaultCacheManager(); 15 | } 16 | 17 | @AfterEach 18 | public void stop() { 19 | infinispanDistributed.stopDefaultCacheManager(); 20 | } 21 | 22 | @Test 23 | public void testDistributed() { 24 | infinispanDistributed.createAndPopulateTheCache(10); 25 | assertEquals(10, infinispanDistributed.cm1.getCache(DIST_CACHE_NAME).size()); 26 | } 27 | } -------------------------------------------------------------------------------- /infinispan-embedded/cache-invalidated/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/infinispan-embedded/cache-invalidated/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /infinispan-embedded/cache-invalidated/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 3 | -------------------------------------------------------------------------------- /infinispan-embedded/cache-invalidated/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | infinispan-simple-tutorials-invalidation-mode 5 | 6 | ../../pom.xml 7 | 1.0.0-SNAPSHOT 8 | org.infinispan.tutorial.simple 9 | infinispan-simple-tutorials 10 | 11 | Infinispan Simple Tutorials: Invalidation Mode 12 | 13 | 14 | 15 | 16 | org.codehaus.mojo 17 | exec-maven-plugin 18 | 19 | 20 | 21 | exec 22 | 23 | 24 | 25 | 26 | java 27 | 28 | -Djava.net.preferIPv4Stack=true 29 | -Djava.util.logging.config.file=src/main/resources/logging.properties 30 | -classpath 31 | 32 | org.infinispan.tutorial.simple.invalidation.InvalidationMode 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | org.infinispan 42 | infinispan-core 43 | 44 | 45 | org.junit.jupiter 46 | junit-jupiter 47 | test 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /infinispan-embedded/cache-invalidated/src/test/java/org/infinispan/tutorial/simple/invalidation/InvalidationModeTest.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.invalidation; 2 | 3 | 4 | import org.infinispan.Cache; 5 | import org.junit.jupiter.api.AfterAll; 6 | import org.junit.jupiter.api.Assertions; 7 | import org.junit.jupiter.api.BeforeAll; 8 | import org.junit.jupiter.api.Test; 9 | 10 | import static org.junit.jupiter.api.Assertions.assertEquals; 11 | 12 | public class InvalidationModeTest { 13 | 14 | @BeforeAll 15 | public static void init() { 16 | InvalidationMode.createCacheManagerAndInitCache(); 17 | } 18 | 19 | @AfterAll 20 | public static void stop() { 21 | InvalidationMode.stopCacheManager(); 22 | } 23 | 24 | @Test 25 | public void testInvalidationMode() { 26 | Assertions.assertNotNull(InvalidationMode.cacheManager); 27 | Assertions.assertNotNull(InvalidationMode.cache); 28 | 29 | Cache cache = InvalidationMode.cache; 30 | cache.putForExternalRead("foo", "bar"); 31 | assertEquals(1, cache.size()); 32 | assertEquals("bar", cache.get("foo")); 33 | } 34 | } -------------------------------------------------------------------------------- /infinispan-embedded/cache-replicated/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/infinispan-embedded/cache-replicated/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /infinispan-embedded/cache-replicated/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 3 | -------------------------------------------------------------------------------- /infinispan-embedded/cache-replicated/src/test/java/org/infinispan/tutorial/simple/replicated/InfinispanReplicatedTest.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.replicated; 2 | 3 | import org.junit.jupiter.api.AfterAll; 4 | import org.junit.jupiter.api.BeforeAll; 5 | import org.junit.jupiter.api.Test; 6 | 7 | import static org.junit.jupiter.api.Assertions.assertEquals; 8 | import static org.junit.jupiter.api.Assertions.assertNotNull; 9 | 10 | public class InfinispanReplicatedTest { 11 | 12 | @BeforeAll 13 | public static void start() { 14 | InfinispanReplicated.createDefaultCacheManagerAndStartCache(); 15 | } 16 | 17 | @AfterAll 18 | public static void stop() { 19 | InfinispanReplicated.stopDefaultCacheManager(); 20 | } 21 | 22 | @Test 23 | public void testReplicatedCache() { 24 | assertNotNull(InfinispanReplicated.cacheManager); 25 | assertNotNull(InfinispanReplicated.cache); 26 | 27 | InfinispanReplicated.manipulateReplicatedCache(); 28 | 29 | assertEquals(10, InfinispanReplicated.cache.size()); 30 | } 31 | 32 | } -------------------------------------------------------------------------------- /infinispan-embedded/clusterexec/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/infinispan-embedded/clusterexec/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /infinispan-embedded/clusterexec/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 3 | -------------------------------------------------------------------------------- /infinispan-embedded/clusterexec/src/main/java/org/infinispan/tutorial/simple/clusterexec/InfinispanClusterExec.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.clusterexec; 2 | 3 | import org.infinispan.configuration.global.GlobalConfigurationBuilder; 4 | import org.infinispan.manager.ClusterExecutor; 5 | import org.infinispan.manager.DefaultCacheManager; 6 | import org.infinispan.manager.EmbeddedCacheManager; 7 | import org.infinispan.remoting.transport.Address; 8 | import org.infinispan.util.function.SerializableFunction; 9 | import org.infinispan.util.function.TriConsumer; 10 | 11 | import java.util.Random; 12 | 13 | public class InfinispanClusterExec { 14 | 15 | DefaultCacheManager cacheManager; 16 | 17 | public static void main(String[] args) { 18 | InfinispanClusterExec infinispanClusterExec = new InfinispanClusterExec(); 19 | infinispanClusterExec.createCacheManager(); 20 | infinispanClusterExec.submitTask(cm -> new Random().nextInt(), 21 | (address, intValue, exception) -> System.out.printf("%s\n", intValue)); 22 | infinispanClusterExec.stopDefaultCacheManager(); 23 | } 24 | 25 | public void submitTask(SerializableFunction task, TriConsumer triConsumer) { 26 | ClusterExecutor clusterExecutor = cacheManager.executor(); 27 | clusterExecutor.submitConsumer(task, triConsumer); 28 | } 29 | 30 | public void createCacheManager() { 31 | // Setup up a clustered cache manager 32 | GlobalConfigurationBuilder global = GlobalConfigurationBuilder.defaultClusteredBuilder(); 33 | // Initialize the cache manager 34 | this.cacheManager = new DefaultCacheManager(global.build()); 35 | } 36 | 37 | public void stopDefaultCacheManager() { 38 | if (cacheManager != null) { 39 | // Shuts down the cache manager and all associated resources 40 | cacheManager.stop(); 41 | cacheManager = null; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /infinispan-embedded/clusterexec/src/test/java/org/infinispan/tutorial/simple/clusterexec/InfinispanClusterExecTest.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.clusterexec; 2 | 3 | 4 | import org.infinispan.remoting.transport.Address; 5 | import org.junit.jupiter.api.AfterEach; 6 | import org.junit.jupiter.api.BeforeEach; 7 | import org.junit.jupiter.api.Test; 8 | 9 | import java.util.HashMap; 10 | import java.util.Map; 11 | import java.util.UUID; 12 | import java.util.concurrent.CountDownLatch; 13 | import java.util.concurrent.TimeUnit; 14 | 15 | import static org.junit.jupiter.api.Assertions.assertEquals; 16 | import static org.junit.jupiter.api.Assertions.assertNotNull; 17 | 18 | public class InfinispanClusterExecTest { 19 | 20 | InfinispanClusterExec infinispanClusterExec = new InfinispanClusterExec(); 21 | 22 | @BeforeEach 23 | public void start() { 24 | infinispanClusterExec.createCacheManager(); 25 | } 26 | 27 | @AfterEach 28 | public void stop() { 29 | infinispanClusterExec.stopDefaultCacheManager(); 30 | } 31 | 32 | @Test 33 | public void testClusteredExec() throws Exception { 34 | UUID uuid = UUID.randomUUID(); 35 | Map values = new HashMap<>(); 36 | CountDownLatch countDownLatch = new CountDownLatch(1); 37 | infinispanClusterExec.submitTask(cm -> uuid.toString(), 38 | (address, result, exception) -> { 39 | values.put(result, address); 40 | countDownLatch.countDown(); 41 | }); 42 | countDownLatch.await(10, TimeUnit.SECONDS); 43 | assertEquals(1, values.size()); 44 | assertNotNull(values.get(uuid.toString())); 45 | } 46 | } -------------------------------------------------------------------------------- /infinispan-embedded/counter/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/infinispan-embedded/counter/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /infinispan-embedded/counter/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 3 | -------------------------------------------------------------------------------- /infinispan-embedded/counter/src/test/java/org/infinispan/tutorial/simple/counter/InfinispanCounterTest.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.counter; 2 | 3 | import org.junit.jupiter.api.AfterEach; 4 | import org.junit.jupiter.api.BeforeEach; 5 | import org.junit.jupiter.api.Test; 6 | 7 | import static org.junit.jupiter.api.Assertions.assertEquals; 8 | import static org.junit.jupiter.api.Assertions.assertNotNull; 9 | 10 | public class InfinispanCounterTest { 11 | 12 | InfinispanCounter infinispanCounter = new InfinispanCounter(); 13 | 14 | @BeforeEach 15 | public void start() { 16 | infinispanCounter.createCounterManager(); 17 | } 18 | 19 | @AfterEach 20 | public void stop() { 21 | infinispanCounter.stopCounterManager(); 22 | } 23 | 24 | @Test 25 | public void testInfinispanCounter() throws Exception { 26 | infinispanCounter.createAndManipulateCounters(); 27 | 28 | assertNotNull(InfinispanCounter.counter1); 29 | assertEquals(9, InfinispanCounter.counter1.sync().getValue()); 30 | assertNotNull(InfinispanCounter.counter2); 31 | assertEquals(2, InfinispanCounter.counter2.sync().getValue()); 32 | assertNotNull(InfinispanCounter.counter3); 33 | assertEquals(8, InfinispanCounter.counter3.sync().getValue()); 34 | } 35 | } -------------------------------------------------------------------------------- /infinispan-embedded/functional/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/infinispan-embedded/functional/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /infinispan-embedded/functional/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 3 | -------------------------------------------------------------------------------- /infinispan-embedded/functional/src/test/java/org/infinispan/tutorial/simple/functional/InfinispanFunctionalTest.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.functional; 2 | 3 | import org.junit.jupiter.api.AfterAll; 4 | import org.junit.jupiter.api.BeforeAll; 5 | import org.junit.jupiter.api.Test; 6 | 7 | import static org.junit.jupiter.api.Assertions.*; 8 | 9 | public class InfinispanFunctionalTest { 10 | 11 | @BeforeAll 12 | public static void start() { 13 | InfinispanFunctional.createAndStartComponents(); 14 | } 15 | 16 | @AfterAll 17 | public static void stop() { 18 | InfinispanFunctional.stop(); 19 | } 20 | 21 | @Test 22 | public void testFunctionalMap() throws Exception { 23 | assertNotNull(InfinispanFunctional.cacheManager); 24 | assertNotNull(InfinispanFunctional.cache); 25 | 26 | InfinispanFunctional.manipulateFunctionalMap(); 27 | 28 | assertEquals(2, InfinispanFunctional.cache.size()); 29 | } 30 | } -------------------------------------------------------------------------------- /infinispan-embedded/jcache/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/infinispan-embedded/jcache/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /infinispan-embedded/jcache/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 3 | -------------------------------------------------------------------------------- /infinispan-embedded/jcache/src/main/java/org/infinispan/tutorial/simple/jcache/InfinispanJCache.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.jcache; 2 | 3 | import javax.cache.Cache; 4 | import javax.cache.CacheManager; 5 | import javax.cache.Caching; 6 | import javax.cache.configuration.MutableConfiguration; 7 | import javax.cache.spi.CachingProvider; 8 | 9 | public class InfinispanJCache { 10 | 11 | static CachingProvider jcacheProvider; 12 | static CacheManager cacheManager; 13 | static Cache cache; 14 | 15 | public static void main(String[] args) { 16 | createAndStartComponents(); 17 | manipulateCache(); 18 | close(); 19 | } 20 | 21 | static void manipulateCache() { 22 | // Store a value 23 | cache.put("key", "value"); 24 | // Retrieve the value and print it out 25 | System.out.printf("key = %s\n", cache.get("key")); 26 | } 27 | 28 | static void createAndStartComponents() { 29 | // Construct a simple local cache manager with default configuration 30 | jcacheProvider = Caching.getCachingProvider(); 31 | cacheManager = jcacheProvider.getCacheManager(); 32 | MutableConfiguration configuration = new MutableConfiguration<>(); 33 | configuration.setTypes(String.class, String.class); 34 | // create a cache using the supplied configuration 35 | cache = cacheManager.createCache("myCache", configuration); 36 | } 37 | 38 | static void close() { 39 | if (cacheManager != null) { 40 | // Stop the cache manager and release all resources 41 | cacheManager.close(); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /infinispan-embedded/jcache/src/test/java/org/infinispan/tutorial/simple/jcache/InfinispanJCacheTest.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.jcache; 2 | 3 | import org.junit.jupiter.api.AfterAll; 4 | import org.junit.jupiter.api.BeforeAll; 5 | import org.junit.jupiter.api.Test; 6 | 7 | import static org.junit.jupiter.api.Assertions.assertEquals; 8 | import static org.junit.jupiter.api.Assertions.assertNotNull; 9 | 10 | public class InfinispanJCacheTest { 11 | 12 | @BeforeAll 13 | public static void start() { 14 | InfinispanJCache.createAndStartComponents(); 15 | } 16 | 17 | @AfterAll 18 | public static void stop() { 19 | InfinispanJCache.close(); 20 | } 21 | 22 | @Test 23 | public void testJCache() { 24 | assertNotNull(InfinispanJCache.jcacheProvider); 25 | assertNotNull(InfinispanJCache.cacheManager); 26 | assertNotNull(InfinispanJCache.cache); 27 | 28 | InfinispanJCache.manipulateCache(); 29 | 30 | assertEquals("value", InfinispanJCache.cache.get("key")); 31 | } 32 | } -------------------------------------------------------------------------------- /infinispan-embedded/kubernetes/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/infinispan-embedded/kubernetes/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /infinispan-embedded/kubernetes/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 3 | -------------------------------------------------------------------------------- /infinispan-embedded/listeners/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/infinispan-embedded/listeners/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /infinispan-embedded/listeners/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 3 | -------------------------------------------------------------------------------- /infinispan-embedded/listeners/src/test/java/org/infinispan/tutorial/simple/listen/InfinispanListenTest.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.listen; 2 | 3 | import org.junit.jupiter.api.AfterAll; 4 | import org.junit.jupiter.api.BeforeAll; 5 | import org.junit.jupiter.api.Test; 6 | 7 | import static org.junit.jupiter.api.Assertions.assertEquals; 8 | import static org.junit.jupiter.api.Assertions.assertNotNull; 9 | 10 | public class InfinispanListenTest { 11 | 12 | @BeforeAll 13 | public static void start() { 14 | InfinispanListen.createAndStartComponents(); 15 | } 16 | 17 | @AfterAll 18 | public static void stop() { 19 | InfinispanListen.stop(); 20 | } 21 | 22 | @Test 23 | public void testListener() { 24 | assertNotNull(InfinispanListen.cacheManager); 25 | assertNotNull(InfinispanListen.cache); 26 | assertNotNull(InfinispanListen.listener); 27 | 28 | InfinispanListen.manipulateCache(); 29 | 30 | assertEquals(2, InfinispanListen.cache.size()); 31 | assertEquals(2, InfinispanListen.listener.created.size()); 32 | assertEquals(1, InfinispanListen.listener.updated.size()); 33 | } 34 | } -------------------------------------------------------------------------------- /infinispan-embedded/lock/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/infinispan-embedded/lock/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /infinispan-embedded/lock/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 3 | -------------------------------------------------------------------------------- /infinispan-embedded/lock/src/test/java/org/infinispan/tutorial/simple/lock/InfinispanClusteredLockTest.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.lock; 2 | 3 | import org.junit.jupiter.api.AfterAll; 4 | import org.junit.jupiter.api.BeforeAll; 5 | import org.junit.jupiter.api.Test; 6 | 7 | import static org.junit.jupiter.api.Assertions.assertEquals; 8 | import static org.junit.jupiter.api.Assertions.assertNotNull; 9 | 10 | public class InfinispanClusteredLockTest { 11 | 12 | @BeforeAll 13 | public static void start() { 14 | InfinispanClusteredLock.createAndStartComponents(); 15 | } 16 | 17 | @AfterAll 18 | public static void stop() { 19 | InfinispanClusteredLock.stop(); 20 | } 21 | 22 | @Test 23 | public void testClusteredLock() throws Exception { 24 | assertNotNull(InfinispanClusteredLock.cacheManager); 25 | assertNotNull(InfinispanClusteredLock.clusteredLockManager); 26 | assertNotNull(InfinispanClusteredLock.lock); 27 | assertNotNull(InfinispanClusteredLock.counter); 28 | 29 | InfinispanClusteredLock.changeCounterWithLocks(); 30 | 31 | assertEquals(3, InfinispanClusteredLock.counter.get()); 32 | } 33 | 34 | } -------------------------------------------------------------------------------- /infinispan-embedded/map/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/infinispan-embedded/map/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /infinispan-embedded/map/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 3 | -------------------------------------------------------------------------------- /infinispan-embedded/map/src/main/java/org/infinispan/tutorial/simple/map/InfinispanMap.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.map; 2 | 3 | import org.infinispan.Cache; 4 | import org.infinispan.configuration.cache.ConfigurationBuilder; 5 | import org.infinispan.manager.DefaultCacheManager; 6 | 7 | public class InfinispanMap { 8 | 9 | static DefaultCacheManager cacheManager; 10 | static Cache cache; 11 | 12 | public static void main(String[] args) { 13 | createAndStartComponents(); 14 | manipulateLocalCache(); 15 | stop(); 16 | } 17 | 18 | static void manipulateLocalCache() { 19 | // Store a value 20 | cache.put("key", "value"); 21 | // Retrieve the value and print it out 22 | System.out.printf("key = %s\n", cache.get("key")); 23 | } 24 | 25 | static void createAndStartComponents() { 26 | // Construct a simple local cache manager with default configuration 27 | cacheManager = new DefaultCacheManager(); 28 | // Define local cache configuration 29 | cacheManager.defineConfiguration("local", new ConfigurationBuilder().build()); 30 | // Obtain the local cache 31 | cache = cacheManager.getCache("local"); 32 | } 33 | 34 | static void stop() { 35 | // Stop the cache manager and release all resources 36 | cacheManager.stop(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /infinispan-embedded/map/src/test/java/org/infinispan/tutorial/simple/map/InfinispanMapTest.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.map; 2 | 3 | import org.junit.jupiter.api.AfterAll; 4 | import org.junit.jupiter.api.BeforeAll; 5 | import org.junit.jupiter.api.Test; 6 | 7 | import static org.junit.jupiter.api.Assertions.assertEquals; 8 | import static org.junit.jupiter.api.Assertions.assertNotNull; 9 | 10 | public class InfinispanMapTest { 11 | 12 | @BeforeAll 13 | public static void start() { 14 | InfinispanMap.createAndStartComponents(); 15 | } 16 | 17 | @AfterAll 18 | public static void stop() { 19 | InfinispanMap.stop(); 20 | } 21 | 22 | @Test 23 | public void testMap() { 24 | assertNotNull(InfinispanMap.cache); 25 | 26 | InfinispanMap.manipulateLocalCache(); 27 | 28 | assertEquals(1, InfinispanMap.cache.size()); 29 | } 30 | } -------------------------------------------------------------------------------- /infinispan-embedded/multimap/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/infinispan-embedded/multimap/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /infinispan-embedded/multimap/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 3 | -------------------------------------------------------------------------------- /infinispan-embedded/multimap/src/test/java/org/infinispan/tutorial/simple/multimap/InfinispanMultimapTest.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.multimap; 2 | 3 | 4 | import org.junit.jupiter.api.AfterAll; 5 | import org.junit.jupiter.api.BeforeAll; 6 | import org.junit.jupiter.api.Test; 7 | 8 | import java.util.concurrent.TimeUnit; 9 | 10 | import static org.junit.jupiter.api.Assertions.assertEquals; 11 | import static org.junit.jupiter.api.Assertions.assertNotNull; 12 | 13 | public class InfinispanMultimapTest { 14 | 15 | @BeforeAll 16 | public static void start() { 17 | InfinispanMultimap.createAndStartComponents(); 18 | } 19 | 20 | @AfterAll 21 | public static void stop() { 22 | InfinispanMultimap.stop(); 23 | } 24 | 25 | @Test 26 | public void testMultimap() throws Exception { 27 | assertNotNull(InfinispanMultimap.multimap); 28 | InfinispanMultimap.manipulateMultimap(); 29 | assertEquals(3, InfinispanMultimap.multimap.size().get(10, TimeUnit.SECONDS)); 30 | } 31 | } -------------------------------------------------------------------------------- /infinispan-embedded/query/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/infinispan-embedded/query/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /infinispan-embedded/query/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 3 | -------------------------------------------------------------------------------- /infinispan-embedded/query/src/main/java/org/infinispan/tutorial/simple/query/Person.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.query; 2 | 3 | 4 | import org.hibernate.search.mapper.pojo.mapping.definition.annotation.Indexed; 5 | import org.hibernate.search.mapper.pojo.mapping.definition.annotation.KeywordField; 6 | 7 | @Indexed 8 | public class Person { 9 | @KeywordField 10 | String name; 11 | 12 | @KeywordField 13 | String surname; 14 | 15 | public Person(String name, String surname) { 16 | this.name = name; 17 | this.surname = surname; 18 | } 19 | 20 | @Override 21 | public String toString() { 22 | return "Person [name=" + name + ", surname=" + surname + "]"; 23 | } 24 | } -------------------------------------------------------------------------------- /infinispan-embedded/query/src/test/java/org/infinispan/tutorial/simple/query/InfinispanQueryTest.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.query; 2 | 3 | 4 | import org.junit.jupiter.api.AfterAll; 5 | import org.junit.jupiter.api.BeforeAll; 6 | import org.junit.jupiter.api.Test; 7 | 8 | import java.util.List; 9 | 10 | import static org.junit.jupiter.api.Assertions.assertEquals; 11 | import static org.junit.jupiter.api.Assertions.assertNotNull; 12 | 13 | public class InfinispanQueryTest { 14 | 15 | @BeforeAll 16 | public static void init() { 17 | InfinispanQuery.createCacheManagerAndCache(); 18 | } 19 | 20 | @AfterAll 21 | public static void stop() { 22 | InfinispanQuery.stopCacheManager(); 23 | } 24 | 25 | @Test 26 | public void testQuery() { 27 | assertNotNull(InfinispanQuery.cacheManager); 28 | assertNotNull(InfinispanQuery.cache); 29 | 30 | List people = InfinispanQuery.addDataAndPerformQuery(); 31 | assertEquals(2, people.size()); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /infinispan-embedded/streams/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/infinispan-embedded/streams/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /infinispan-embedded/streams/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 3 | -------------------------------------------------------------------------------- /infinispan-embedded/streams/src/main/java/org/infinispan/tutorial/simple/streams/InfinispanStreams.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.streams; 2 | 3 | import org.infinispan.Cache; 4 | import org.infinispan.configuration.cache.ConfigurationBuilder; 5 | import org.infinispan.manager.DefaultCacheManager; 6 | 7 | import java.util.stream.Collectors; 8 | import java.util.stream.IntStream; 9 | 10 | public class InfinispanStreams { 11 | 12 | DefaultCacheManager cm1; 13 | Cache cache; 14 | 15 | public static void main(String[] args) { 16 | InfinispanStreams streams = new InfinispanStreams(); 17 | streams.createDefaultCacheManagerAndInitCache(); 18 | streams.storeKeyValues(10); 19 | int result = streams.mapAndReduceKeys(); 20 | streams.printResult(result); 21 | streams.stopDefaultCacheManager(); 22 | } 23 | 24 | public void storeKeyValues(int range) { 25 | // Store some values 26 | IntStream.range(0, range).boxed().forEach(i -> cache.put(i + "-key", i + "-value")); 27 | } 28 | 29 | public int mapAndReduceKeys() { 30 | // Map and reduce the keys 31 | return cache.keySet().stream() 32 | .map(e -> Integer.valueOf(e.substring(0, e.indexOf("-")))) 33 | .collect(() -> Collectors.summingInt(i -> i.intValue())); 34 | } 35 | 36 | public void printResult(int result) { 37 | System.out.printf("Result = %d\n", result); 38 | } 39 | 40 | public void createDefaultCacheManagerAndInitCache() { 41 | // Construct a simple local cache manager with default configuration 42 | cm1 = new DefaultCacheManager(); 43 | // Define local cache configuration 44 | cm1.defineConfiguration("local", new ConfigurationBuilder().build()); 45 | // Obtain the local cache 46 | cache = cm1.getCache("local"); 47 | } 48 | 49 | public void stopDefaultCacheManager() { 50 | if (cm1 != null) { 51 | // Stop the cache manager and release all resources 52 | cm1.stop(); 53 | cm1 = null; 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /infinispan-embedded/streams/src/test/java/org/infinispan/tutorial/simple/streams/InfinispanStreamsTest.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.streams; 2 | 3 | import org.junit.jupiter.api.AfterEach; 4 | import org.junit.jupiter.api.BeforeEach; 5 | import org.junit.jupiter.api.Test; 6 | 7 | import static org.junit.jupiter.api.Assertions.assertEquals; 8 | 9 | public class InfinispanStreamsTest { 10 | 11 | InfinispanStreams infinispanStreams = new InfinispanStreams(); 12 | 13 | @BeforeEach 14 | public void start() { 15 | infinispanStreams.createDefaultCacheManagerAndInitCache(); 16 | } 17 | 18 | @AfterEach 19 | public void stop() { 20 | infinispanStreams.stopDefaultCacheManager(); 21 | } 22 | 23 | @Test 24 | public void testStreamsCache() { 25 | infinispanStreams.storeKeyValues(20); 26 | assertEquals(20, infinispanStreams.cache.size()); 27 | int result = infinispanStreams.mapAndReduceKeys(); 28 | assertEquals(190, result); 29 | } 30 | } -------------------------------------------------------------------------------- /infinispan-embedded/transactions/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/infinispan-embedded/transactions/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /infinispan-embedded/transactions/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 3 | -------------------------------------------------------------------------------- /infinispan-embedded/transactions/src/test/java/org/infinispan/tutorial/simple/tx/InfinispanTxTest.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.tx; 2 | 3 | import org.junit.jupiter.api.AfterEach; 4 | import org.junit.jupiter.api.BeforeEach; 5 | import org.junit.jupiter.api.Test; 6 | 7 | import java.util.Map; 8 | 9 | import static org.junit.jupiter.api.Assertions.assertEquals; 10 | import static org.junit.jupiter.api.Assertions.assertNull; 11 | 12 | public class InfinispanTxTest { 13 | 14 | InfinispanTx infinispanTx = new InfinispanTx(); 15 | 16 | @BeforeEach 17 | public void start() { 18 | infinispanTx.createDefaultCacheManagerAndInitCache(); 19 | } 20 | 21 | @AfterEach 22 | public void stop() { 23 | infinispanTx.stopDefaultCacheManager(); 24 | } 25 | 26 | @Test 27 | public void testTransactionalCache() throws Exception { 28 | infinispanTx.putAndCommit(Map.of("key", "value")); 29 | assertEquals(1, infinispanTx.cache.size()); 30 | assertEquals("value", infinispanTx.cache.get("key")); 31 | infinispanTx.putAndRollback(Map.of("key", "another", "hello", "world")); 32 | assertEquals("value", infinispanTx.cache.get("key")); 33 | assertNull(infinispanTx.cache.get("hello")); 34 | } 35 | } -------------------------------------------------------------------------------- /infinispan-remote/cache-admin-api/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/infinispan-remote/cache-admin-api/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /infinispan-remote/cache-admin-api/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 3 | -------------------------------------------------------------------------------- /infinispan-remote/cache-admin-api/src/main/resources/CacheWithXMLConfiguration.xml: -------------------------------------------------------------------------------- 1 | " 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /infinispan-remote/cache-admin-api/src/main/resources/cacheTemplate.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /infinispan-remote/cache-admin-api/src/test/java/org/infinispan/tutorial/simple/remote/admin/InfinispanRemoteAdminCacheTest.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.remote.admin; 2 | 3 | import org.junit.jupiter.api.AfterAll; 4 | import org.junit.jupiter.api.BeforeAll; 5 | import org.junit.jupiter.api.Test; 6 | 7 | import java.io.IOException; 8 | 9 | import static org.infinispan.tutorial.simple.remote.admin.InfinispanRemoteAdminCache.CACHE_WITH_TEMPLATE; 10 | import static org.infinispan.tutorial.simple.remote.admin.InfinispanRemoteAdminCache.CACHE_WITH_XMLCONFIGURATION; 11 | import static org.infinispan.tutorial.simple.remote.admin.InfinispanRemoteAdminCache.SIMPLE_CACHE; 12 | import static org.junit.jupiter.api.Assertions.assertNotNull; 13 | 14 | public class InfinispanRemoteAdminCacheTest { 15 | 16 | @BeforeAll 17 | public static void start() { 18 | InfinispanRemoteAdminCache.connectToInfinispan(); 19 | } 20 | 21 | @AfterAll 22 | public static void stop() { 23 | InfinispanRemoteAdminCache.disconnect(); 24 | } 25 | 26 | @Test 27 | public void testCacheManager() { 28 | assertNotNull(InfinispanRemoteAdminCache.cacheManager); 29 | } 30 | 31 | @Test 32 | public void testCreateSimpleCache() { 33 | InfinispanRemoteAdminCache.createSimpleCache(); 34 | assertNotNull(InfinispanRemoteAdminCache.cacheManager.getCache(SIMPLE_CACHE)); 35 | } 36 | 37 | @Test 38 | public void testCreateWithTemplate() throws IOException { 39 | InfinispanRemoteAdminCache.cacheWithTemplate(); 40 | assertNotNull(InfinispanRemoteAdminCache.cacheManager.getCache(CACHE_WITH_TEMPLATE)); 41 | } 42 | 43 | @Test 44 | public void createCacheWithXMLConfiguration() throws IOException { 45 | InfinispanRemoteAdminCache.createCacheWithXMLConfiguration(); 46 | assertNotNull(InfinispanRemoteAdminCache.cacheManager.getCache(CACHE_WITH_XMLCONFIGURATION)); 47 | } 48 | } -------------------------------------------------------------------------------- /infinispan-remote/cache-alias/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/infinispan-remote/cache-alias/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /infinispan-remote/cache-alias/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 3 | -------------------------------------------------------------------------------- /infinispan-remote/cache-alias/src/main/java/org/infinispan/tutorial/simple/alias/InfinispanCacheAlias.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.alias; 2 | 3 | import org.infinispan.client.hotrod.RemoteCache; 4 | import org.infinispan.client.hotrod.RemoteCacheManager; 5 | import org.infinispan.tutorial.simple.connect.TutorialsConnectorHelper; 6 | 7 | import static org.infinispan.tutorial.simple.connect.TutorialsConnectorHelper.TUTORIAL_CACHE_NAME; 8 | 9 | /** 10 | * Runs with Infinispan 15.1 or higher 11 | */ 12 | public class InfinispanCacheAlias { 13 | 14 | static RemoteCacheManager cacheManager; 15 | static RemoteCache cache; 16 | static RemoteCache cacheAlias; 17 | 18 | public static void main(String[] args) { 19 | connectToInfinispan(); 20 | manipulateCache(); 21 | addAlias(); 22 | disconnect(); 23 | } 24 | 25 | static void manipulateCache() { 26 | // Store a value 27 | cache.put("key", "value"); 28 | // Retrieve the value and print it out 29 | System.out.printf("key = %s\n", cache.get("key")); 30 | } 31 | 32 | static void addAlias() { 33 | cacheManager.administration().updateConfigurationAttribute(cache.getName(), "aliases", "alias alias2"); 34 | // Retrieve the value and print it out 35 | cacheAlias = cacheManager.getCache("alias"); 36 | if (cacheAlias != null) { 37 | System.out.printf("key = %s\n", cacheAlias.get("key")); 38 | } 39 | } 40 | 41 | static void connectToInfinispan() { 42 | // Connect to the server 43 | cacheManager = TutorialsConnectorHelper.connect(); 44 | // Obtain the remote cache 45 | cache = cacheManager.getCache(TUTORIAL_CACHE_NAME); 46 | } 47 | 48 | static void disconnect() { 49 | // Stop the cache manager and release all resources 50 | TutorialsConnectorHelper.stop(cacheManager); 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /infinispan-remote/cache-alias/src/test/java/org/infinispan/tutorial/simple/alias/InfinispanCacheAliasTest.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.alias; 2 | 3 | import org.junit.jupiter.api.AfterAll; 4 | import org.junit.jupiter.api.BeforeAll; 5 | import org.junit.jupiter.api.Test; 6 | 7 | import static org.junit.Assert.assertEquals; 8 | import static org.junit.Assert.assertNull; 9 | import static org.junit.jupiter.api.Assertions.assertNotNull; 10 | 11 | public class InfinispanCacheAliasTest { 12 | 13 | @BeforeAll 14 | public static void start() { 15 | InfinispanCacheAlias.connectToInfinispan(); 16 | } 17 | 18 | @AfterAll 19 | public static void stop() { 20 | InfinispanCacheAlias.disconnect(); 21 | } 22 | 23 | @Test 24 | public void testCacheAlias() { 25 | assertNotNull(InfinispanCacheAlias.cache); 26 | assertNull(InfinispanCacheAlias.cacheAlias); 27 | 28 | InfinispanCacheAlias.manipulateCache(); 29 | assertEquals("value", InfinispanCacheAlias.cache.get("key")); 30 | 31 | InfinispanCacheAlias.addAlias(); 32 | assertNotNull(InfinispanCacheAlias.cacheAlias); 33 | assertEquals("value", InfinispanCacheAlias.cacheAlias.get("key")); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /infinispan-remote/cache/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/infinispan-remote/cache/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /infinispan-remote/cache/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 3 | -------------------------------------------------------------------------------- /infinispan-remote/cache/src/main/java/org/infinispan/tutorial/simple/remote/InfinispanRemoteCache.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.remote; 2 | 3 | import org.infinispan.client.hotrod.RemoteCache; 4 | import org.infinispan.client.hotrod.RemoteCacheManager; 5 | import org.infinispan.tutorial.simple.connect.TutorialsConnectorHelper; 6 | 7 | import static org.infinispan.tutorial.simple.connect.TutorialsConnectorHelper.TUTORIAL_CACHE_NAME; 8 | 9 | public class InfinispanRemoteCache { 10 | static RemoteCacheManager cacheManager; 11 | static RemoteCache cache; 12 | 13 | public static void main(String[] args) { 14 | connectToInfinispan(); 15 | manipulateCache(); 16 | disconnect(); 17 | } 18 | 19 | static void manipulateCache() { 20 | // Store a value 21 | cache.put("key", "value"); 22 | // Retrieve the value and print it out 23 | System.out.printf("key = %s\n", cache.get("key")); 24 | } 25 | 26 | static void connectToInfinispan() { 27 | // Connect to the server 28 | cacheManager = TutorialsConnectorHelper.connect(); 29 | // Obtain the remote cache 30 | cache = cacheManager.getCache(TUTORIAL_CACHE_NAME); 31 | } 32 | 33 | static void disconnect() { 34 | // Stop the cache manager and release all resources 35 | TutorialsConnectorHelper.stop(cacheManager); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /infinispan-remote/cache/src/test/java/org/infinispan/tutorial/simple/remote/InfinispanRemoteCacheTest.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.remote; 2 | 3 | import org.junit.jupiter.api.AfterAll; 4 | import org.junit.jupiter.api.BeforeAll; 5 | import org.junit.jupiter.api.Test; 6 | 7 | import static org.junit.jupiter.api.Assertions.assertEquals; 8 | import static org.junit.jupiter.api.Assertions.assertNotNull; 9 | 10 | public class InfinispanRemoteCacheTest { 11 | 12 | @BeforeAll 13 | public static void start() { 14 | InfinispanRemoteCache.connectToInfinispan(); 15 | } 16 | 17 | @AfterAll 18 | public static void stop() { 19 | InfinispanRemoteCache.disconnect(); 20 | } 21 | 22 | @Test 23 | public void testRemoteCache() { 24 | assertNotNull(InfinispanRemoteCache.cache); 25 | 26 | InfinispanRemoteCache.manipulateCache(); 27 | 28 | assertEquals("value", InfinispanRemoteCache.cache.get("key")); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /infinispan-remote/connect-to-infinispan-server/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/infinispan-remote/connect-to-infinispan-server/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /infinispan-remote/connect-to-infinispan-server/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 3 | -------------------------------------------------------------------------------- /infinispan-remote/connect-to-infinispan-server/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | connect-to-infinispan-server 5 | 6 | ../../pom.xml 7 | 1.0.0-SNAPSHOT 8 | org.infinispan.tutorial.simple 9 | infinispan-simple-tutorials 10 | 11 | Connect to Infinispan Server 12 | 13 | Common code to connect to a running Infinispan Server 14 | 15 | 16 | 17 | org.infinispan 18 | infinispan-client-hotrod 19 | 20 | 21 | org.infinispan 22 | infinispan-server-testdriver-core 23 | 24 | 25 | org.testcontainers 26 | testcontainers 27 | 1.21.1 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /infinispan-remote/continuous-query/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/infinispan-remote/continuous-query/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /infinispan-remote/continuous-query/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 3 | -------------------------------------------------------------------------------- /infinispan-remote/continuous-query/src/main/java/org/infinispan/tutorial/simple/remote/query/InstaPost.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.remote.query; 2 | 3 | import org.infinispan.protostream.annotations.Proto; 4 | 5 | /** 6 | * This class is annotated with the infinispan Protostream support annotations. With this method, you don't need to 7 | * define a protobuf file and a marshaller for the object. See this tutorial for additional explanations: 8 | *

9 | * https://blog.infinispan.org/2018/06/making-java-objects-queryable-by.html 10 | */ 11 | @Proto 12 | public record InstaPost(String id, String user, String hashtag){} 13 | -------------------------------------------------------------------------------- /infinispan-remote/continuous-query/src/main/java/org/infinispan/tutorial/simple/remote/query/InstaSchema.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.remote.query; 2 | 3 | import org.infinispan.protostream.GeneratedSchema; 4 | import org.infinispan.protostream.annotations.ProtoSchema; 5 | 6 | @ProtoSchema(schemaFileName = "instapost.proto", 7 | schemaPackageName = "tutorial", 8 | includeClasses = InstaPost.class) 9 | public interface InstaSchema extends GeneratedSchema { 10 | } 11 | -------------------------------------------------------------------------------- /infinispan-remote/continuous-query/src/test/java/org/infinispan/tutorial/simple/remote/query/InfinispanRemoteContinuousQueryTest.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.remote.query; 2 | 3 | import org.junit.jupiter.api.AfterAll; 4 | import org.junit.jupiter.api.BeforeAll; 5 | import org.junit.jupiter.api.Test; 6 | 7 | import static org.infinispan.tutorial.simple.connect.TutorialsConnectorHelper.TUTORIAL_CACHE_NAME; 8 | import static org.junit.jupiter.api.Assertions.assertEquals; 9 | import static org.junit.jupiter.api.Assertions.assertNotNull; 10 | 11 | public class InfinispanRemoteContinuousQueryTest { 12 | 13 | @BeforeAll 14 | public static void start() throws Exception { 15 | InfinispanRemoteContinuousQuery.connectToInfinispan(); 16 | } 17 | 18 | @AfterAll 19 | public static void stop() { 20 | InfinispanRemoteContinuousQuery.disconnect(); 21 | } 22 | 23 | @Test 24 | public void testContinuousQuery() throws Exception { 25 | assertNotNull(InfinispanRemoteContinuousQuery.client); 26 | 27 | InfinispanRemoteContinuousQuery.createPostsAndQuery(1, false); 28 | 29 | assertEquals(1, InfinispanRemoteContinuousQuery.queryPosts.size()); 30 | assertEquals(1, InfinispanRemoteContinuousQuery.client.getCache(TUTORIAL_CACHE_NAME).size()); 31 | } 32 | 33 | } -------------------------------------------------------------------------------- /infinispan-remote/counter/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/infinispan-remote/counter/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /infinispan-remote/counter/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 3 | -------------------------------------------------------------------------------- /infinispan-remote/counter/src/test/java/org/infinispan/tutorial/simple/remote/counter/InfinispanRemoteCounterTest.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.remote.counter; 2 | 3 | import org.junit.jupiter.api.AfterAll; 4 | import org.junit.jupiter.api.BeforeAll; 5 | import org.junit.jupiter.api.Test; 6 | 7 | import static org.junit.jupiter.api.Assertions.*; 8 | 9 | public class InfinispanRemoteCounterTest { 10 | 11 | @BeforeAll 12 | public static void start() { 13 | InfinispanRemoteCounter.connectToInfinispan(); 14 | } 15 | 16 | @AfterAll 17 | public static void stop() { 18 | InfinispanRemoteCounter.disconnect(); 19 | } 20 | 21 | @Test 22 | public void testRemoteCounters() throws Exception { 23 | assertNotNull(InfinispanRemoteCounter.cacheManager); 24 | assertNotNull(InfinispanRemoteCounter.counterManager); 25 | 26 | InfinispanRemoteCounter.manipulateCounters(); 27 | 28 | assertNotNull(InfinispanRemoteCounter.counter1); 29 | assertNotNull(InfinispanRemoteCounter.counter2); 30 | assertNotNull(InfinispanRemoteCounter.counter3); 31 | assertEquals(9, InfinispanRemoteCounter.counter1.sync().getValue()); 32 | assertEquals(2, InfinispanRemoteCounter.counter2.sync().getValue()); 33 | assertEquals(8, InfinispanRemoteCounter.counter3.sync().getValue()); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /infinispan-remote/cross-site-replication/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/infinispan-remote/cross-site-replication/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /infinispan-remote/cross-site-replication/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 3 | -------------------------------------------------------------------------------- /infinispan-remote/cross-site-replication/docker-compose/create-data.sh: -------------------------------------------------------------------------------- 1 | echo "= Init create data" 2 | echo "= Clear all data" 3 | curl -XDELETE --digest -u admin:password http://localhost:11222/rest/v2/caches/xsiteCache 4 | curl -XDELETE --digest -u admin:password http://localhost:31222/rest/v2/caches/xsiteCache 5 | 6 | echo "= Create X-Site Cache" 7 | curl -XPOST --digest -u admin:password -H "Content-Type: application/xml" -d "@xsiteCache.xml" http://localhost:11222/rest/v2/caches/xsiteCache 8 | curl -XPOST --digest -u admin:password -H "Content-Type: application/xml" -d "@ny-backup-xsiteCache.xml" http://localhost:31222/rest/v2/caches/xsiteCache 9 | 10 | echo "= Put 10 entries in XSite cache" 11 | for i in {1..10} 12 | do 13 | URL='http://localhost:11222/rest/v2/caches/xsiteCache/key_'$i 14 | DATA='{ 15 | "_type": "string", 16 | "_value": "value_'$i'" 17 | }' 18 | curl -XPOST --digest -u admin:password -d "$DATA" -H 'Content-Type: application/json' $URL 19 | done 20 | 21 | echo "= End" 22 | -------------------------------------------------------------------------------- /infinispan-remote/cross-site-replication/docker-compose/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | 3 | networks: 4 | mynetwork: 5 | driver: bridge 6 | services: 7 | infinispan-server-lon-1: 8 | image: quay.io/infinispan/server:15.2 9 | ports: 10 | - "11222:11222" 11 | container_name: ispn-lon-1 12 | environment: 13 | USER: admin 14 | PASS: password 15 | networks: 16 | - mynetwork 17 | command: -c infinispan-xsite.xml -Dinfinispan.site.name=LON -Djgroups.mcast_port=46656 18 | infinispan-server-lon-2: 19 | image: quay.io/infinispan/server:15.2 20 | ports: 21 | - "11221:11222" 22 | container_name: ispn-lon-2 23 | environment: 24 | USER: admin 25 | PASS: password 26 | networks: 27 | - mynetwork 28 | command: -c infinispan-xsite.xml -Dinfinispan.site.name=LON -Djgroups.mcast_port=46656 29 | infinispan-server-nyc-1: 30 | image: quay.io/infinispan/server:15.2 31 | ports: 32 | - "31222:11222" 33 | container_name: ispn-nyc-1 34 | environment: 35 | USER: admin 36 | PASS: password 37 | networks: 38 | - mynetwork 39 | command: -c infinispan-xsite.xml -Dinfinispan.site.name=NYC -Djgroups.mcast_port=46666 40 | infinispan-server-nyc-2: 41 | image: quay.io/infinispan/server:15.2 42 | ports: 43 | - "31223:11222" 44 | container_name: ispn-nyc-2 45 | environment: 46 | USER: admin 47 | PASS: password 48 | networks: 49 | - mynetwork 50 | command: -c infinispan-xsite.xml -Dinfinispan.site.name=NYC -Djgroups.mcast_port=46666 -------------------------------------------------------------------------------- /infinispan-remote/cross-site-replication/docker-compose/ny-backup-xsiteCache.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /infinispan-remote/cross-site-replication/docker-compose/xsiteCache.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /infinispan-remote/cross-site-replication/minikube/LON.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: infinispan.org/v1 2 | kind: Infinispan 3 | metadata: 4 | name: example-cluster-lon 5 | spec: 6 | replicas: 2 7 | expose: 8 | type: NodePort 9 | nodePort: 30000 10 | security: 11 | endpointSecretName: connect-secret-cluster-lon 12 | service: 13 | type: DataGrid 14 | sites: 15 | local: 16 | name: LON 17 | expose: 18 | type: ClusterIP 19 | locations: 20 | - name: LON 21 | url: infinispan+xsite://example-cluster-lon-site 22 | - name: NYC 23 | url: infinispan+xsite://example-cluster-nyc-site -------------------------------------------------------------------------------- /infinispan-remote/cross-site-replication/minikube/NYC.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: infinispan.org/v1 2 | kind: Infinispan 3 | metadata: 4 | name: example-cluster-nyc 5 | spec: 6 | replicas: 2 7 | expose: 8 | type: NodePort 9 | nodePort: 30001 10 | security: 11 | endpointSecretName: connect-secret-cluster-nyc 12 | service: 13 | type: DataGrid 14 | sites: 15 | local: 16 | name: NYC 17 | expose: 18 | type: ClusterIP 19 | locations: 20 | - name: LON 21 | url: infinispan+xsite://example-cluster-lon-site 22 | - name: NYC 23 | url: infinispan+xsite://example-cluster-nyc-site -------------------------------------------------------------------------------- /infinispan-remote/cross-site-replication/minikube/cache_lon.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: infinispan.org/v2alpha1 2 | kind: Cache 3 | metadata: 4 | name: mycache-site-lon 5 | spec: 6 | clusterName: example-cluster-lon 7 | name: mycache 8 | template: |- 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /infinispan-remote/cross-site-replication/minikube/cache_nyc.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: infinispan.org/v2alpha1 2 | kind: Cache 3 | metadata: 4 | name: mycache-site-nyc 5 | spec: 6 | clusterName: example-cluster-nyc 7 | name: mycache 8 | template: |- 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /infinispan-remote/cross-site-replication/minikube/create-data.sh: -------------------------------------------------------------------------------- 1 | export LON_SITE_EXTERNAL=$(minikube service --url example-cluster-lon-external) 2 | 3 | echo "= Put 10 entries in LON cache" 4 | for i in {1..10} 5 | do 6 | URL=$LON_SITE_EXTERNAL'/rest/v2/caches/mycache/key_'-$i 7 | DATA='{ 8 | "_type": "string", 9 | "_value": "value_'$i'" 10 | }' 11 | curl -XPOST --digest -u admin:password -d "$DATA" -H 'Content-Type: application/json' $URL 12 | done 13 | 14 | echo "= End" 15 | -------------------------------------------------------------------------------- /infinispan-remote/cross-site-replication/minikube/identities_lon.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Secret 3 | metadata: 4 | name: connect-secret-cluster-lon 5 | type: Opaque 6 | stringData: 7 | identities.yaml: |- 8 | credentials: 9 | - username: admin 10 | password: password 11 | -------------------------------------------------------------------------------- /infinispan-remote/cross-site-replication/minikube/identities_nyc.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Secret 3 | metadata: 4 | name: connect-secret-cluster-nyc 5 | type: Opaque 6 | stringData: 7 | identities.yaml: |- 8 | credentials: 9 | - username: admin 10 | password: password 11 | -------------------------------------------------------------------------------- /infinispan-remote/cross-site-replication/minikube/setup.sh: -------------------------------------------------------------------------------- 1 | # Starts Minikube 2 | echo 'Starting Minikube' 3 | minikube start --driver=virtualbox --cpus 4 --memory "8192mb" 4 | 5 | # Installs Operator in Minikube 6 | echo 'Installing the Operator in Minikube' 7 | curl -sL https://github.com/operator-framework/operator-lifecycle-manager/releases/download/v0.22.0/install.sh | bash -s v0.22.0 8 | kubectl create -f https://operatorhub.io/install/infinispan.yaml 9 | kubectl get csv 10 | sleep 30 11 | echo 'Operator Ready' 12 | 13 | # Identity (admin/password), Clusters and Caches 14 | echo 'Using the Operator to create Identities, LON + NYC clusters and caches' 15 | kubectl create -f identities_lon.yaml 16 | kubectl create -f identities_nyc.yaml 17 | kubectl apply -f LON.yaml 18 | kubectl apply -f NYC.yaml 19 | kubectl apply -f cache_lon.yaml 20 | kubectl apply -f cache_nyc.yaml 21 | 22 | # Checks these clusters are up 23 | kubectl wait --timeout=120s --for=condition=CrossSiteViewFormed infinispan example-cluster-lon 24 | kubectl wait --timeout=120s --for=condition=CrossSiteViewFormed infinispan example-cluster-nyc 25 | 26 | echo 'Services are ready' 27 | minikube service list -------------------------------------------------------------------------------- /infinispan-remote/cross-site-replication/src/test/java/org/infinispan/tutorial/simple/remote/xsite/InfinispanRemoteSwitchClusterTest.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.remote.xsite; 2 | 3 | import org.junit.jupiter.api.AfterAll; 4 | import org.junit.jupiter.api.BeforeAll; 5 | import org.junit.jupiter.api.Test; 6 | 7 | import static org.junit.jupiter.api.Assertions.assertNotNull; 8 | import static org.junit.jupiter.api.Assertions.assertTrue; 9 | 10 | public class InfinispanRemoteSwitchClusterTest { 11 | 12 | @BeforeAll 13 | public static void start() { 14 | InfinispanRemoteSwitchCluster.connectToInfinispan(); 15 | } 16 | 17 | @AfterAll 18 | public static void stop() { 19 | InfinispanRemoteSwitchCluster.disconnect(true); 20 | } 21 | 22 | @Test 23 | public void testXSite() { 24 | assertNotNull(InfinispanRemoteSwitchCluster.XSITE_CACHE); 25 | 26 | InfinispanRemoteSwitchCluster.manipulateCacheAndSwitchCluster(); 27 | 28 | assertNotNull(InfinispanRemoteSwitchCluster.log); 29 | String log = InfinispanRemoteSwitchCluster.log.toString(); 30 | assertTrue(log.contains("LON members")); 31 | assertTrue(log.contains("11222")); 32 | assertTrue(log.contains("NYC members")); 33 | assertTrue(log.contains("31223")); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /infinispan-remote/encoding/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/infinispan-remote/encoding/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /infinispan-remote/encoding/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 3 | -------------------------------------------------------------------------------- /infinispan-remote/encoding/src/main/resources/jsonCache.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /infinispan-remote/encoding/src/main/resources/textCache.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /infinispan-remote/encoding/src/main/resources/xmlCache.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /infinispan-remote/encoding/src/test/java/org/infinispan/tutorial/simple/encoding/InfinispanEncodingCachesTest.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.encoding; 2 | 3 | 4 | import org.junit.jupiter.api.AfterAll; 5 | import org.junit.jupiter.api.BeforeAll; 6 | import org.junit.jupiter.api.Test; 7 | 8 | import static org.junit.jupiter.api.Assertions.assertEquals; 9 | import static org.junit.jupiter.api.Assertions.assertNotNull; 10 | 11 | public class InfinispanEncodingCachesTest { 12 | 13 | @BeforeAll 14 | public static void start() throws Exception { 15 | InfinispanEncodingCaches.connectToInfinispan(); 16 | } 17 | 18 | @AfterAll 19 | public static void stop() { 20 | InfinispanEncodingCaches.disconnect(true); 21 | } 22 | 23 | @Test 24 | public void testEncoding() { 25 | assertNotNull(InfinispanEncodingCaches.cacheManager); 26 | assertNotNull(InfinispanEncodingCaches.xmlCache); 27 | assertNotNull(InfinispanEncodingCaches.textCache); 28 | assertNotNull(InfinispanEncodingCaches.jsonCache); 29 | 30 | InfinispanEncodingCaches.manipulateCachesAndPrint(); 31 | 32 | assertEquals("infinispan", InfinispanEncodingCaches.xmlCache.get("xml")); 33 | assertEquals("{\"name\": \"infinispan\"}", InfinispanEncodingCaches.jsonCache.get("\"json\"")); 34 | assertEquals("诶, 你好.", InfinispanEncodingCaches.textCache.get("text")); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /infinispan-remote/infinispan-secured-keycloak/docker-compose-no-linux.yaml: -------------------------------------------------------------------------------- 1 | version: '3.1' 2 | 3 | networks: 4 | mynetwork: 5 | driver: bridge 6 | 7 | services: 8 | keycloak: 9 | image: quay.io/keycloak/keycloak:26 10 | ports: 11 | - "8080:8080" 12 | volumes: 13 | - ./infinispan-keycloak-realm.json:/opt/keycloak/data/import/infinispan-keycloak-realm.json 14 | container_name: keycloak 15 | environment: 16 | KEYCLOAK_ADMIN: keycloak 17 | KEYCLOAK_ADMIN_PASSWORD: keycloak 18 | command: ['start-dev', '--import-realm'] 19 | networks: 20 | - mynetwork 21 | 22 | infinispan-server: 23 | image: quay.io/infinispan/server:15.2 24 | ports: 25 | - "11222:11222" 26 | volumes: 27 | - ./infinispan-token-realm.yaml:/user-config/infinispan-token-realm-no-linux.yaml 28 | depends_on: 29 | - "keycloak" 30 | container_name: ispn 31 | environment: 32 | USER: admin 33 | PASS: password 34 | command: -c infinispan.xml -c /user-config/infinispan-token-realm-no-linux.yaml 35 | networks: 36 | - mynetwork 37 | -------------------------------------------------------------------------------- /infinispan-remote/infinispan-secured-keycloak/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | version: '3.1' 2 | 3 | services: 4 | keycloak: 5 | image: quay.io/keycloak/keycloak:26.0 6 | volumes: 7 | - ./infinispan-keycloak-realm.json:/opt/keycloak/data/import/infinispan-keycloak-realm.json 8 | container_name: keycloak 9 | environment: 10 | KEYCLOAK_ADMIN: keycloak 11 | KEYCLOAK_ADMIN_PASSWORD: keycloak 12 | command: ['start-dev', '--import-realm'] 13 | network_mode: host 14 | 15 | infinispan-server: 16 | image: quay.io/infinispan/server:15.2 17 | volumes: 18 | - ./infinispan-token-realm.yaml:/user-config/infinispan-token-realm.yaml 19 | depends_on: 20 | - "keycloak" 21 | container_name: ispn 22 | environment: 23 | USER: admin 24 | PASS: password 25 | command: -c infinispan.xml -c /user-config/infinispan-token-realm.yaml 26 | network_mode: host 27 | -------------------------------------------------------------------------------- /infinispan-remote/infinispan-secured-keycloak/infinispan-token-realm-no-linux.yaml: -------------------------------------------------------------------------------- 1 | server: 2 | security: 3 | securityRealms: 4 | - name: default 5 | tokenRealm: 6 | name: infinispan 7 | authServerUrl: 'http://keycloak:8080' 8 | client-id: infinispan-console 9 | oauth2Introspection: 10 | clientId: infinispan-server 11 | clientSecret: '1fdca4ec-c416-47e0-867a-3d471af7050f' 12 | introspectionUrl: 'http://keycloak:8080/realms/infinispan/protocol/openid-connect/token/introspect' 13 | 14 | -------------------------------------------------------------------------------- /infinispan-remote/infinispan-secured-keycloak/infinispan-token-realm.yaml: -------------------------------------------------------------------------------- 1 | ### Map 127.0.0.1 keycloak in /etc/hosts file 2 | server: 3 | security: 4 | securityRealms: 5 | - name: default 6 | tokenRealm: 7 | name: infinispan 8 | authServerUrl: 'http://keycloak:8080' 9 | client-id: infinispan-console 10 | oauth2Introspection: 11 | clientId: infinispan-server 12 | clientSecret: '1fdca4ec-c416-47e0-867a-3d471af7050f' 13 | introspectionUrl: 'http://keycloak:8080/realms/infinispan/protocol/openid-connect/token/introspect' 14 | 15 | -------------------------------------------------------------------------------- /infinispan-remote/junit5/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/infinispan-remote/junit5/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /infinispan-remote/junit5/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 3 | -------------------------------------------------------------------------------- /infinispan-remote/junit5/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | infinispan-simple-tutorials-remote-junit5 5 | 6 | ../../pom.xml 7 | 1.0.0-SNAPSHOT 8 | org.infinispan.tutorial.simple 9 | infinispan-simple-tutorials 10 | 11 | Infinispan Simple Tutorials: Remote Junit 5 12 | 13 | 14 | 15 | org.infinispan 16 | infinispan-client-hotrod 17 | 18 | 19 | org.infinispan 20 | infinispan-server-testdriver-junit5 21 | ${version.infinispan} 22 | test 23 | 24 | 25 | 26 | 27 | 28 | 29 | maven-surefire-plugin 30 | 3.5.3 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /infinispan-remote/junit5/src/main/java/org/infinispan/tutorial/simple/remote/junit5/CachingService.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.remote.junit5; 2 | 3 | import org.infinispan.client.hotrod.DefaultTemplate; 4 | import org.infinispan.client.hotrod.RemoteCache; 5 | import org.infinispan.client.hotrod.RemoteCacheManager; 6 | 7 | /** 8 | * Caching service to be tested using JUnit 5 and the Infinispan Server Extension 9 | */ 10 | public class CachingService { 11 | 12 | private RemoteCache cache; 13 | 14 | public CachingService(RemoteCache cache) { 15 | this.cache = cache; 16 | } 17 | 18 | public CachingService(RemoteCacheManager cacheManager) { 19 | this.cache = cacheManager.administration() 20 | .getOrCreateCache("names", DefaultTemplate.DIST_SYNC); 21 | } 22 | 23 | public void storeName(String id, String name) { 24 | cache.put(id, name); 25 | } 26 | 27 | public boolean exists(String name) { 28 | return cache.containsValue(name); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /infinispan-remote/listeners/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/infinispan-remote/listeners/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /infinispan-remote/listeners/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 3 | -------------------------------------------------------------------------------- /infinispan-remote/listeners/src/test/java/org/infinispan/tutorial/simple/remote/listen/InfinispanRemoteListenTest.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.remote.listen; 2 | 3 | import org.junit.jupiter.api.AfterAll; 4 | import org.junit.jupiter.api.Assertions; 5 | import org.junit.jupiter.api.BeforeAll; 6 | import org.junit.jupiter.api.Test; 7 | 8 | import static org.junit.jupiter.api.Assertions.assertEquals; 9 | import static org.junit.jupiter.api.Assertions.assertNotNull; 10 | import static org.junit.jupiter.api.Assertions.assertTrue; 11 | 12 | public class InfinispanRemoteListenTest { 13 | 14 | @BeforeAll 15 | public static void start() { 16 | InfinispanRemoteListen.connectToInfinispan(); 17 | } 18 | 19 | @AfterAll 20 | public static void stop() { 21 | InfinispanRemoteListen.disconnect(true); 22 | } 23 | 24 | @Test 25 | public void testRemoteListen() throws Exception { 26 | assertNotNull(InfinispanRemoteListen.cacheManager); 27 | assertNotNull(InfinispanRemoteListen.cache); 28 | 29 | InfinispanRemoteListen.registerListener(); 30 | 31 | assertNotNull(InfinispanRemoteListen.listener); 32 | 33 | InfinispanRemoteListen.manipulateCache(); 34 | 35 | Thread.sleep(1000); 36 | 37 | String logTrack = InfinispanRemoteListen.listener.logTrack.toString(); 38 | assertEquals(2, InfinispanRemoteListen.cache.size()); 39 | assertTrue(logTrack.contains("Created")); 40 | assertTrue(logTrack.contains("About to modify")); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /infinispan-remote/multimap/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/infinispan-remote/multimap/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /infinispan-remote/multimap/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 3 | -------------------------------------------------------------------------------- /infinispan-remote/multimap/src/test/java/org/infinispan/tutorial/simple/remote/multimap/InfinispanRemoteMultimapTest.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.remote.multimap; 2 | 3 | import org.junit.jupiter.api.AfterAll; 4 | import org.junit.jupiter.api.BeforeAll; 5 | import org.junit.jupiter.api.Test; 6 | 7 | import java.util.Collection; 8 | import java.util.concurrent.TimeUnit; 9 | 10 | import static org.junit.jupiter.api.Assertions.assertEquals; 11 | import static org.junit.jupiter.api.Assertions.assertNotNull; 12 | 13 | public class InfinispanRemoteMultimapTest { 14 | 15 | @BeforeAll 16 | public static void start() { 17 | InfinispanRemoteMultimap.connectToInfinispan(); 18 | } 19 | 20 | @AfterAll 21 | public static void stop() { 22 | InfinispanRemoteMultimap.disconnect(true); 23 | } 24 | 25 | @Test 26 | public void testRemoteMultimap() throws Exception { 27 | assertNotNull(InfinispanRemoteMultimap.cacheManager); 28 | assertNotNull(InfinispanRemoteMultimap.multimapCacheManager); 29 | assertNotNull(InfinispanRemoteMultimap.multimap); 30 | 31 | InfinispanRemoteMultimap.manipulateMultimap(); 32 | Collection people = InfinispanRemoteMultimap.multimap.get(2018).get(10, TimeUnit.SECONDS); 33 | assertEquals(1, people.size()); 34 | assertEquals("Richard", people.toArray()[0]); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /infinispan-remote/near-cache/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/infinispan-remote/near-cache/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /infinispan-remote/near-cache/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 3 | -------------------------------------------------------------------------------- /infinispan-remote/near-cache/src/test/java/org/infinispan/tutorial/simple/nearcache/InfinispanNearCacheTest.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.nearcache; 2 | 3 | import org.junit.jupiter.api.AfterAll; 4 | import org.junit.jupiter.api.BeforeAll; 5 | import org.junit.jupiter.api.Test; 6 | 7 | import static org.junit.jupiter.api.Assertions.assertNotNull; 8 | 9 | public class InfinispanNearCacheTest { 10 | 11 | @BeforeAll 12 | public static void start() { 13 | InfinispanNearCache.connectToInfinispan(); 14 | } 15 | 16 | @AfterAll 17 | public static void stop() { 18 | InfinispanNearCache.disconnect(true); 19 | } 20 | 21 | @Test 22 | public void testNearCache() { 23 | assertNotNull(InfinispanNearCache.testCache); 24 | assertNotNull(InfinispanNearCache.withNearCaching); 25 | } 26 | 27 | } -------------------------------------------------------------------------------- /infinispan-remote/opentelemetry/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/infinispan-remote/opentelemetry/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /infinispan-remote/opentelemetry/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 3 | -------------------------------------------------------------------------------- /infinispan-remote/opentelemetry/docker-compose/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | 3 | networks: 4 | mynetwork: 5 | driver: bridge 6 | services: 7 | jaeger: 8 | image: jaegertracing/all-in-one:1.57 9 | ports: 10 | - "16686:16686" 11 | - "4318:4318" 12 | container_name: jaeger 13 | environment: 14 | - LOG_LEVEL=debug 15 | networks: 16 | - mynetwork 17 | infinispan-tracing: 18 | image: quay.io/infinispan/server:15.2 19 | ports: 20 | - "11222:11222" 21 | container_name: infinispan-tracing 22 | environment: 23 | USER: admin 24 | PASS: password 25 | volumes: 26 | - ./infinispan-tracing-configuration-server.yaml:/user-config/infinispan-tracing-configuration-server.yaml:Z 27 | command: -c infinispan.xml -c /user-config/infinispan-tracing-configuration-server.yaml 28 | networks: 29 | - mynetwork 30 | -------------------------------------------------------------------------------- /infinispan-remote/opentelemetry/docker-compose/infinispan-tracing-configuration-server.yaml: -------------------------------------------------------------------------------- 1 | infinispan: 2 | cacheContainer: 3 | statistics: true 4 | tracing: 5 | collector-endpoint: "http://jaeger:4318" 6 | enabled: true 7 | exporter-protocol: "OTLP" 8 | service-name: "infinispan-server" 9 | security: false -------------------------------------------------------------------------------- /infinispan-remote/opentelemetry/src/main/java/org/infinispan/tutorial/simple/remote/opentelemetry/InfinispanRemoteOpenTelemetry.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.remote.opentelemetry; 2 | 3 | import org.infinispan.client.hotrod.RemoteCache; 4 | import org.infinispan.client.hotrod.RemoteCacheManager; 5 | import org.infinispan.client.hotrod.configuration.ConfigurationBuilder; 6 | import org.infinispan.tutorial.simple.connect.TutorialsConnectorHelper; 7 | 8 | import static org.infinispan.tutorial.simple.connect.TutorialsConnectorHelper.TUTORIAL_CACHE_NAME; 9 | 10 | /** 11 | * Shows how to enable tracing programatically in a cache, sends operations and traces 12 | * are displayed in Jaeger. 13 | * 14 | * Execute after running the docker-compose script in the docker-compose directory. 15 | */ 16 | public class InfinispanRemoteOpenTelemetry { 17 | public static void main(String[] args) { 18 | ConfigurationBuilder builder = TutorialsConnectorHelper.connectionConfig(); 19 | 20 | try (RemoteCacheManager client = TutorialsConnectorHelper.connect(builder)) { 21 | RemoteCache cache = client.getCache(TUTORIAL_CACHE_NAME); 22 | 23 | // Enabled tracing at runtime by changing the configuration. 24 | client.administration() 25 | .updateConfigurationAttribute(cache.getName(), "tracing.enabled", "true"); 26 | 27 | for (int i = 0; i < 300; i++) { 28 | cache.put("i" + i, i + ""); 29 | } 30 | 31 | client.stop(); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /infinispan-remote/operator/minikube/Makefile: -------------------------------------------------------------------------------- 1 | REPO ?= infinispan/infinispan-operator/0.3.0 2 | NAMESPACE ?= operator-testing 3 | IMAGE ?= "" 4 | 5 | .PHONY: deploy run build test all 6 | 7 | .DEFAULT_GOAL := all 8 | 9 | ## deploy: Deploy the Operator on a Minikube cluster (requires cluster admin access). 10 | deploy: 11 | ./deploy.sh $(REPO) $(NAMESPACE) $(IMAGE) 12 | 13 | ## run: Run the Operator to create a cluster. 14 | run: 15 | ./run.sh $(REPO) $(NAMESPACE) 16 | 17 | ## build: Build the tutorial demo code. 18 | build: 19 | ./build.sh $(NAMESPACE) 20 | 21 | ## test: Test the tutorial steps. 22 | test: 23 | ./test.sh $(NAMESPACE) 24 | 25 | ## all: Execute all tutorial steps. 26 | all: deploy run build test 27 | -------------------------------------------------------------------------------- /infinispan-remote/operator/minikube/README.md: -------------------------------------------------------------------------------- 1 | Testing This Quickstart 2 | ----------------------- 3 | Use the `Makefile` and supporting scripts to test this tutorial. 4 | 5 | **Environment Prerequisites** 6 | * A running [Minikube](https://kubernetes.io/docs/setup/learning-environment/minikube/) cluster. 7 | * Recommended Minikube settings are 4 CPUs and 4GB of memory. 8 | 9 | Run the following command to test all tutorial steps: 10 | ```bash 11 | $ make all 12 | ``` 13 | 14 | Inspect the `Makefile` and supporting scripts files to find out more about testing. 15 | 16 | Testing Custom Descriptors 17 | -------------------------- 18 | Pass the `REPO` parameter to test custom descriptors in a specific repository/branch of the Infinispan Operator. 19 | 20 | For example, run the following command: 21 | ```bash 22 | $ make REPO=myrepository/infinispan-operator/test-branch all 23 | ``` 24 | 25 | Testing Custom Images 26 | --------------------- 27 | Pass the `IMAGE` parameter with the `deploy` target to test custom Infinispan Operator images. 28 | 29 | For example, run the following command: 30 | ```bash 31 | $ make IMAGE=path/to/image deploy 32 | ``` 33 | 34 | **Insecure Registries:** 35 | Do the following to test with custom images that reside in insecure registries: 36 | 37 | 1. Delete the Minikube Virtual Machine. This step prevents an [issue](https://github.com/kubernetes/minikube/issues/604#issuecomment-247813764) where the insecure registry is ignored. 38 | ```bash 39 | $ minikube delete 40 | ``` 41 | 2. Include the `--insecure-registry` flag to enable the insecure registry. 42 | ```bash 43 | $ minikube start --insecure-registry : 44 | ``` 45 | -------------------------------------------------------------------------------- /infinispan-remote/operator/minikube/build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | 4 | set -e -x 5 | 6 | NAMESPACE=$1 7 | 8 | 9 | # Delete any leftovers 10 | clean() { 11 | kubectl delete route example-infinispan -n ${NAMESPACE} || true 12 | } 13 | 14 | 15 | # Expose service for external access 16 | build() { 17 | kubectl expose svc example-infinispan \ 18 | --port 8080 \ 19 | --target-port=8080 \ 20 | --name=example-infinispan-http \ 21 | --type=NodePort \ 22 | -n ${NAMESPACE} 23 | 24 | sleep 5 25 | } 26 | 27 | 28 | main() { 29 | clean 30 | build 31 | } 32 | 33 | 34 | main 35 | -------------------------------------------------------------------------------- /infinispan-remote/operator/minikube/deploy.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | 4 | set -e -x 5 | 6 | REPO=$1 7 | NAMESPACE=$2 8 | IMAGE=$3 9 | 10 | REPO_URL=https://raw.githubusercontent.com/${REPO} 11 | 12 | 13 | # Delete any leftovers 14 | clean() { 15 | kubectl delete namespace ${NAMESPACE} || true 16 | } 17 | 18 | 19 | # Deploy operator and other components 20 | deploy() { 21 | kubectl create namespace ${NAMESPACE} 22 | 23 | kubectl apply -f ${REPO_URL}/deploy/rbac.yaml -n ${NAMESPACE} 24 | 25 | if [ -z "${IMAGE}" ]; then 26 | kubectl apply -f ${REPO_URL}/deploy/operator.yaml -n ${NAMESPACE} 27 | else 28 | local targetDir='../target' 29 | mkdir ${targetDir} || true 30 | curl -o ${targetDir}/operator.yaml ${REPO_URL}/deploy/operator.yaml 31 | sed -ri 's@^(\s*)(image\s*:\s*jboss.*\s*$)@\1image: '"${IMAGE}"'@' ${targetDir}/operator.yaml 32 | kubectl apply -f ${targetDir}/operator.yaml -n ${NAMESPACE} 33 | fi 34 | 35 | kubectl apply -f ${REPO_URL}/deploy/crd.yaml -n ${NAMESPACE} 36 | } 37 | 38 | 39 | main() { 40 | clean 41 | deploy 42 | } 43 | 44 | 45 | main 46 | -------------------------------------------------------------------------------- /infinispan-remote/operator/minikube/run.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | 4 | set -e 5 | 6 | REPO=$1 7 | NAMESPACE=$2 8 | NUM_INSTANCES=2 9 | 10 | REPO_URL=https://raw.githubusercontent.com/${REPO} 11 | 12 | 13 | # Delete any leftovers 14 | clean() { 15 | kubectl delete infinispan example-infinispan -n ${NAMESPACE} || true 16 | } 17 | 18 | 19 | # Run example Infinispan cluster 20 | run() { 21 | kubectl apply -f ${REPO_URL}/deploy/cr/cr_minimal.yaml -n ${NAMESPACE} 22 | } 23 | 24 | 25 | # Wait for cluster to form 26 | wait() { 27 | local expectedClusterSize=${NUM_INSTANCES} 28 | local clusterSizeCmd="/subsystem=datagrid-infinispan/cache-container=clustered/:read-attribute(name=cluster-size)" 29 | 30 | local podName 31 | local connectCmd='' 32 | local members='' 33 | while [[ "$members" != \"${expectedClusterSize}\" ]]; 34 | do 35 | until podName=$(kubectl get pod -l app=infinispan-pod -o jsonpath="{.items[0].metadata.name}" -n ${NAMESPACE}); do sleep 1; echo Retrying...; done 36 | connectCmd="kubectl exec -it ${podName} -n ${NAMESPACE} -- /opt/jboss/infinispan-server/bin/ispn-cli.sh --connect" 37 | members=$(${connectCmd} ${clusterSizeCmd} | grep result | tr -d '\r' | awk '{print $3}') 38 | if [[ "$members" != \"${expectedClusterSize}\" ]]; then 39 | # Try alternative location 40 | connectCmd="kubectl exec -it ${podName} -n ${NAMESPACE} -- /opt/datagrid/bin/cli.sh --connect" 41 | members=$(${connectCmd} ${clusterSizeCmd} | grep result | tr -d '\r' | awk '{print $3}') 42 | fi 43 | 44 | echo "Waiting for clusters to form (main: $members)" 45 | sleep 10 46 | done 47 | } 48 | 49 | 50 | main() { 51 | clean 52 | run 53 | wait 54 | } 55 | 56 | 57 | main 58 | -------------------------------------------------------------------------------- /infinispan-remote/operator/minikube/test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | 4 | set -e 5 | 6 | NAMESPACE=$1 7 | 8 | 9 | # Test using http 10 | test() { 11 | local host=$(minikube ip) 12 | local port=$(kubectl get service example-infinispan-http \ 13 | -n ${NAMESPACE} \ 14 | -o jsonpath="{.spec.ports[0].nodePort}") 15 | 16 | local pass=$(kubectl get secret example-infinispan-app-generated-secret \ 17 | -n ${NAMESPACE} \ 18 | -o jsonpath="{.data.password}" \ 19 | | base64 --decode) 20 | 21 | curl -v \ 22 | -X POST \ 23 | -u developer:${pass} \ 24 | -H 'Content-type: text/plain' \ 25 | -d 'test-value' \ 26 | http://${host}:${port}/rest/default/test-key 27 | 28 | curl -v \ 29 | -u developer:${pass} \ 30 | http://${host}:${port}/rest/default/test-key 31 | } 32 | 33 | 34 | main() { 35 | test 36 | } 37 | 38 | 39 | main 40 | -------------------------------------------------------------------------------- /infinispan-remote/operator/openshift/README.md: -------------------------------------------------------------------------------- 1 | Testing This Quickstart 2 | ----------------------- 3 | Use the `Makefile` and supporting scripts to test this tutorial. 4 | 5 | **Environment Prerequisites** 6 | * A running Red Hat OpenShift 4.1 cluster with administrator access. 7 | 8 | Run the following command to test all tutorial steps: 9 | ```bash 10 | $ make all 11 | ``` 12 | 13 | Inspect the `Makefile` and supporting scripts files to find out more about testing. 14 | 15 | Testing Custom Descriptors 16 | -------------------------- 17 | Pass the `REPO` parameter to test custom descriptors in a specific repository or branch of the Infinispan Operator. 18 | 19 | For example, run the following command: 20 | ```bash 21 | $ make REPO=myrepository/infinispan-operator/test-branch all 22 | ``` 23 | -------------------------------------------------------------------------------- /infinispan-remote/per-cache-configuration/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/infinispan-remote/per-cache-configuration/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /infinispan-remote/per-cache-configuration/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 3 | -------------------------------------------------------------------------------- /infinispan-remote/per-cache-configuration/src/main/resources/cacheConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /infinispan-remote/per-cache-configuration/src/test/java/org/infinispan/tutorial/simple/remote/percache/InfinispanRemotePerCacheTest.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.remote.percache; 2 | 3 | import org.junit.jupiter.api.AfterAll; 4 | import org.junit.jupiter.api.BeforeAll; 5 | import org.junit.jupiter.api.Test; 6 | 7 | import static org.junit.jupiter.api.Assertions.assertNotNull; 8 | import static org.junit.jupiter.api.Assertions.assertNull; 9 | 10 | 11 | public class InfinispanRemotePerCacheTest { 12 | 13 | @BeforeAll 14 | public static void start() throws Exception { 15 | InfinispanRemotePerCache.connectToInfinispan(); 16 | } 17 | 18 | @AfterAll 19 | public static void stop() { 20 | InfinispanRemotePerCache.disconnect(true); 21 | } 22 | 23 | @Test 24 | public void testRemotePerCacheConfiguration() { 25 | assertNotNull(InfinispanRemotePerCache.cacheManager); 26 | assertNull(InfinispanRemotePerCache.cache); 27 | assertNull(InfinispanRemotePerCache.anotherCache); 28 | assertNull(InfinispanRemotePerCache.uriCache); 29 | 30 | InfinispanRemotePerCache.manipulateCaches(); 31 | assertNotNull(InfinispanRemotePerCache.cache); 32 | assertNotNull(InfinispanRemotePerCache.anotherCache); 33 | assertNotNull(InfinispanRemotePerCache.uriCache); 34 | } 35 | } -------------------------------------------------------------------------------- /infinispan-remote/persistence/README.md: -------------------------------------------------------------------------------- 1 | # Use H2 driver with in standalone mode 2 | 3 | - Download the Infinispan Server (13 or above version) 4 | -Use the install command with the Command Line Interface (CLI) to download the required drivers to the server/lib directory, for example: 5 | ```shell 6 | ./infinispan-server-13.0.6.Final/bin/cli.sh install com.h2database:h2:2.0.202 7 | ``` 8 | - Create the user 9 | ```shell 10 | ./infinispan-server-13.0.6.Final/bin/cli.sh user create admin -p password 11 | ``` 12 | - Run the server 13 | 14 | ```shell 15 | ./infinispan-server-13.0.6.Final/bin/server.sh 16 | ``` 17 | 18 | - Build the project 19 | ```shell 20 | mvn clean install 21 | ``` 22 | 23 | - Run 24 | ```shell 25 | mvn exec:exec 26 | ``` 27 | -------------------------------------------------------------------------------- /infinispan-remote/persistence/sql-store/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/infinispan-remote/persistence/sql-store/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /infinispan-remote/persistence/sql-store/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 3 | -------------------------------------------------------------------------------- /infinispan-remote/persistence/sql-store/src/main/java/org/infinispan/tutorial/simple/remote/persistence/Author.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.remote.persistence; 2 | 3 | import org.infinispan.protostream.annotations.Proto; 4 | 5 | @Proto 6 | public record Author(int id, String isbn, String name, String country) {} 7 | 8 | -------------------------------------------------------------------------------- /infinispan-remote/persistence/sql-store/src/main/java/org/infinispan/tutorial/simple/remote/persistence/Book.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.remote.persistence; 2 | 3 | import org.infinispan.protostream.annotations.Proto; 4 | 5 | @Proto 6 | public record Book(String isbn, String title, String authorName, String country) {} 7 | -------------------------------------------------------------------------------- /infinispan-remote/persistence/sql-store/src/main/java/org/infinispan/tutorial/simple/remote/persistence/ProtostreamSchemaUploader.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.remote.persistence; 2 | 3 | import org.infinispan.client.hotrod.RemoteCache; 4 | import org.infinispan.client.hotrod.RemoteCacheManager; 5 | import org.infinispan.protostream.GeneratedSchema; 6 | 7 | import static org.infinispan.query.remote.client.ProtobufMetadataManagerConstants.PROTOBUF_METADATA_CACHE_NAME; 8 | 9 | public class ProtostreamSchemaUploader { 10 | 11 | private final RemoteCacheManager cacheManager; 12 | 13 | public ProtostreamSchemaUploader(RemoteCacheManager cacheManager) { 14 | this.cacheManager = cacheManager; 15 | } 16 | 17 | public void registerSchema() { 18 | RemoteCache metadataCache = 19 | cacheManager.getCache(PROTOBUF_METADATA_CACHE_NAME); 20 | GeneratedSchema schema = new TechLibrarySchemaImpl(); 21 | metadataCache.put(schema.getProtoFileName(), schema.getProtoFile()); 22 | } 23 | 24 | public void unregisterSchema() { 25 | RemoteCache metadataCache = 26 | cacheManager.getCache(PROTOBUF_METADATA_CACHE_NAME); 27 | GeneratedSchema schema = new TechLibrarySchemaImpl(); 28 | metadataCache.remove(schema.getProtoFileName()); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /infinispan-remote/persistence/sql-store/src/main/java/org/infinispan/tutorial/simple/remote/persistence/TechLibrarySchema.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.remote.persistence; 2 | 3 | import org.infinispan.protostream.GeneratedSchema; 4 | import org.infinispan.protostream.annotations.ProtoSchema; 5 | 6 | @ProtoSchema(schemaPackageName = "library", includeClasses = {Book.class, Author.class}) 7 | public interface TechLibrarySchema extends GeneratedSchema { 8 | } 9 | -------------------------------------------------------------------------------- /infinispan-remote/persistence/sql-store/src/main/resources/initDB.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS books; 2 | DROP TABLE IF EXISTS authors; 3 | 4 | CREATE TABLE authors ( 5 | id INT NOT NULL PRIMARY KEY, 6 | isbn VARCHAR(30) NOT NULL, 7 | name VARCHAR(30) NOT NULL, 8 | country VARCHAR(30) NOT NULL 9 | ); 10 | 11 | CREATE INDEX authors_isbn ON authors (isbn); 12 | 13 | CREATE TABLE books ( 14 | id INT NOT NULL PRIMARY KEY , 15 | isbn VARCHAR(30) NOT NULL, 16 | title VARCHAR(50) NOT NULL, 17 | author_id INTEGER NOT NULL 18 | ); 19 | 20 | CREATE INDEX books_isbn ON books (isbn); 21 | 22 | alter table if exists books 23 | add constraint author_id_constraint 24 | foreign key (author_id) 25 | references AUTHORS; 26 | -------------------------------------------------------------------------------- /infinispan-remote/persistence/sql-store/src/main/resources/populateDB.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO authors VALUES (1, '10-000-555', 'Tristan Tarrant', 'Italy'); 2 | INSERT INTO authors VALUES (2, '11-000-556', 'Clément Escoffier', 'France'); 3 | INSERT INTO authors VALUES (3, '12-000-557', 'Alex Soto', 'Spain'); 4 | INSERT INTO authors VALUES (4, '13-000-558', 'Antonio Goncalves', 'France'); 5 | INSERT INTO books VALUES (1, '20-111-000', 'Building Reactive Microservices in Java',2); 6 | INSERT INTO books VALUES (2, '21-111-001', 'Practising Quarkus', 4); 7 | INSERT INTO books VALUES (3, '22-111-002', 'Infinispan Cookbook', 1); 8 | INSERT INTO books VALUES (4, '21-111-003', 'Quarkus Cookbook', 3); 9 | -------------------------------------------------------------------------------- /infinispan-remote/persistence/sql-store/src/main/resources/sqlQueryCache.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 12 | 13 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /infinispan-remote/persistence/sql-store/src/main/resources/sqlTableCache.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /infinispan-remote/persistence/sql-store/src/test/java/org/infinispan/tutorial/simple/remote/persistence/DBCreatorTest.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.remote.persistence; 2 | 3 | import org.junit.jupiter.api.AfterAll; 4 | import org.junit.jupiter.api.BeforeAll; 5 | import org.junit.jupiter.api.Test; 6 | import org.junit.jupiter.api.TestInstance; 7 | 8 | import java.util.List; 9 | 10 | import static org.junit.jupiter.api.Assertions.assertEquals; 11 | import static org.junit.jupiter.api.Assertions.assertTrue; 12 | 13 | @TestInstance(TestInstance.Lifecycle.PER_CLASS) 14 | public class DBCreatorTest { 15 | 16 | DBCreator dbCreator = new DBCreator(); 17 | 18 | @BeforeAll 19 | public void startTest() { 20 | dbCreator.startDBServer("9124"); 21 | } 22 | 23 | @AfterAll 24 | public void stopTest() { 25 | dbCreator.stopDBServer(); 26 | } 27 | 28 | @Test 29 | public void createAndPopulateDB() { 30 | dbCreator.startDBServer(); 31 | dbCreator.createAndPopulate(); 32 | 33 | List authors = dbCreator.readAuthors(); 34 | 35 | assertEquals(4, authors.size()); 36 | 37 | List bookIds = dbCreator.loadBooksId(); 38 | assertEquals(4, bookIds.size()); 39 | assertTrue(bookIds.contains("20-111-000")); 40 | } 41 | 42 | } -------------------------------------------------------------------------------- /infinispan-remote/programmatic-protostream-marshalling/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/infinispan-remote/programmatic-protostream-marshalling/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /infinispan-remote/programmatic-protostream-marshalling/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 3 | -------------------------------------------------------------------------------- /infinispan-remote/programmatic-protostream-marshalling/src/main/java/org/infinispan/tutorial/simple/remote/marshalling/Magazine.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.remote.marshalling; 2 | 3 | import java.time.YearMonth; 4 | import java.util.List; 5 | 6 | public record Magazine(String name, YearMonth publicationDate, List stories) { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /infinispan-remote/programmatic-protostream-marshalling/src/main/java/org/infinispan/tutorial/simple/remote/marshalling/MagazineMarshaller.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.remote.marshalling; 2 | 3 | import org.infinispan.protostream.MessageMarshaller; 4 | 5 | import java.io.IOException; 6 | import java.time.YearMonth; 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | 10 | public class MagazineMarshaller implements MessageMarshaller { 11 | @Override 12 | public Magazine readFrom(ProtoStreamReader reader) throws IOException { 13 | String name = reader.readString("name"); 14 | YearMonth yearMonth = YearMonth.of(reader.readInt("publicationYear"), reader.readInt("publicationMonth")); 15 | List stories = reader.readCollection("stories", new ArrayList<>(), String.class); 16 | return new Magazine(name, yearMonth, stories); 17 | } 18 | 19 | @Override 20 | public void writeTo(ProtoStreamWriter writer, Magazine magazine) throws IOException { 21 | writer.writeString("name", magazine.name()); 22 | YearMonth yearMonth = magazine.publicationDate(); 23 | writer.writeInt("publicationYear", yearMonth.getYear()); 24 | writer.writeInt("publicationMonth", yearMonth.getMonthValue()); 25 | writer.writeCollection("stories", magazine.stories(), String.class); 26 | } 27 | 28 | @Override 29 | public Class getJavaClass() { 30 | return Magazine.class; 31 | } 32 | 33 | @Override 34 | public String getTypeName() { 35 | return "magazine_sample.Magazine"; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /infinispan-remote/programmatic-protostream-marshalling/src/main/java/org/infinispan/tutorial/simple/remote/marshalling/MagazineSchemaCreator.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.remote.marshalling; 2 | 3 | import org.infinispan.protostream.schema.Schema; 4 | import org.infinispan.protostream.schema.Type; 5 | 6 | public final class MagazineSchemaCreator { 7 | static public Schema magazineSchema() { 8 | return new Schema.Builder("magazine.proto") 9 | .packageName("magazine_sample") 10 | .addMessage("Magazine") 11 | .addField(Type.Scalar.STRING, "name", 1) 12 | .addField(Type.Scalar.INT32, "publicationYear", 2) 13 | .addField(Type.Scalar.INT32, "publicationMonth", 3) 14 | .addRepeatedField(Type.Scalar.STRING, "stories", 4) 15 | .build(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /infinispan-remote/programmatic-protostream-marshalling/src/test/java/org/infinispan/tutorial/simple/remote/marshalling/InfinispanProgrammaticProtostreamMarshallingTest.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.remote.marshalling; 2 | 3 | import org.junit.jupiter.api.AfterAll; 4 | import org.junit.jupiter.api.BeforeAll; 5 | import org.junit.jupiter.api.Test; 6 | 7 | import static org.junit.jupiter.api.Assertions.assertEquals; 8 | import static org.junit.jupiter.api.Assertions.assertNotNull; 9 | 10 | public class InfinispanProgrammaticProtostreamMarshallingTest { 11 | 12 | @BeforeAll 13 | public static void start() throws Exception { 14 | InfinispanProgrammaticProtostreamMarshalling.connectToInfinispan(); 15 | } 16 | 17 | @AfterAll 18 | public static void stop() { 19 | InfinispanProgrammaticProtostreamMarshalling.disconnect(true); 20 | } 21 | 22 | @Test 23 | public void testMarshalling() throws Exception { 24 | assertNotNull(InfinispanProgrammaticProtostreamMarshalling.client); 25 | assertNotNull(InfinispanProgrammaticProtostreamMarshalling.magazineRemoteCache); 26 | 27 | assertEquals(0, InfinispanProgrammaticProtostreamMarshalling.magazineRemoteCache.size()); 28 | InfinispanProgrammaticProtostreamMarshalling.manipulateCache(); 29 | assertEquals(3, InfinispanProgrammaticProtostreamMarshalling.magazineRemoteCache.size()); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /infinispan-remote/query/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/infinispan-remote/query/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /infinispan-remote/query/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 3 | -------------------------------------------------------------------------------- /infinispan-remote/query/src/main/java/org/infinispan/tutorial/simple/remote/query/Person.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.remote.query; 2 | 3 | import org.infinispan.api.annotations.indexing.Indexed; 4 | import org.infinispan.api.annotations.indexing.Keyword; 5 | import org.infinispan.protostream.annotations.Proto; 6 | 7 | /** 8 | * This class is annotated with the infinispan Protostream support annotations. 9 | * With this method, you don't need to define a protobuf file and a marshaller for the object. 10 | */ 11 | @Proto 12 | @Indexed(keyEntity = "tutorial.PersonKey") 13 | public record Person(@Keyword(projectable = true, sortable = true, normalizer = "lowercase", indexNullAs = "unnamed", norms = false) 14 | String firstName, 15 | @Keyword(projectable = true, sortable = true, normalizer = "lowercase", indexNullAs = "unnamed", norms = false) 16 | String lastName, 17 | int bornYear, 18 | @Keyword(projectable = true, sortable = true, normalizer = "lowercase", indexNullAs = "unnamed", norms = false) 19 | String bornIn 20 | ) {} -------------------------------------------------------------------------------- /infinispan-remote/query/src/main/java/org/infinispan/tutorial/simple/remote/query/PersonKey.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.remote.query; 2 | 3 | import org.infinispan.api.annotations.indexing.Basic; 4 | import org.infinispan.api.annotations.indexing.Indexed; 5 | import org.infinispan.protostream.annotations.Proto; 6 | 7 | @Proto 8 | @Indexed 9 | public record PersonKey(@Basic(projectable = true) String id, 10 | @Basic(projectable = true) String pseudo) { 11 | } 12 | -------------------------------------------------------------------------------- /infinispan-remote/query/src/main/java/org/infinispan/tutorial/simple/remote/query/TutorialSchema.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.remote.query; 2 | 3 | import org.infinispan.protostream.GeneratedSchema; 4 | import org.infinispan.protostream.annotations.ProtoSchema; 5 | 6 | @ProtoSchema(schemaPackageName = "tutorial", includeClasses = { Person.class, PersonKey.class }) 7 | public interface TutorialSchema extends GeneratedSchema { 8 | } 9 | -------------------------------------------------------------------------------- /infinispan-remote/query/src/main/resources/indexedCache.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | tutorial.Person 9 | 10 | 11 | -------------------------------------------------------------------------------- /infinispan-remote/reactive-api/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/infinispan-remote/reactive-api/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /infinispan-remote/reactive-api/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 3 | -------------------------------------------------------------------------------- /infinispan-remote/reactive-api/src/test/java/org/infinispan/tutorial/simple/reactive/InfinispanReactiveApiTest.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.reactive; 2 | 3 | import org.junit.jupiter.api.AfterAll; 4 | import org.junit.jupiter.api.BeforeAll; 5 | import org.junit.jupiter.api.Disabled; 6 | import org.junit.jupiter.api.Test; 7 | 8 | import static org.infinispan.tutorial.simple.connect.TutorialsConnectorHelper.TUTORIAL_CACHE_NAME; 9 | import static org.junit.jupiter.api.Assertions.assertEquals; 10 | import static org.junit.jupiter.api.Assertions.assertNotNull; 11 | 12 | public class InfinispanReactiveApiTest { 13 | 14 | @BeforeAll 15 | public static void start() { 16 | InfinispanReactiveApi.connect(); 17 | } 18 | 19 | @AfterAll 20 | public static void stop() { 21 | InfinispanReactiveApi.disconnect(true); 22 | } 23 | 24 | @Test 25 | public void testReactive() { 26 | assertNotNull(InfinispanReactiveApi.infinispan); 27 | InfinispanReactiveApi.initCache(); 28 | assertNotNull(InfinispanReactiveApi.cache); 29 | InfinispanReactiveApi.manipulateCacheReactive(); 30 | assertEquals("reactive", InfinispanReactiveApi 31 | .infinispan.sync().caches() 32 | .get(TUTORIAL_CACHE_NAME).get("hello")); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /infinispan-remote/redis-client/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/infinispan-remote/redis-client/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /infinispan-remote/redis-client/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 3 | -------------------------------------------------------------------------------- /infinispan-remote/redis-client/src/test/java/org/infinispan/tutorial/simple/redis/RedisClientCacheTest.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.redis; 2 | 3 | import org.junit.jupiter.api.AfterAll; 4 | import org.junit.jupiter.api.BeforeAll; 5 | import org.junit.jupiter.api.Test; 6 | 7 | import static org.infinispan.tutorial.simple.redis.RedisClientCache.jedis; 8 | import static org.infinispan.tutorial.simple.redis.RedisClientCache.manipulateWithRESP; 9 | import static org.junit.jupiter.api.Assertions.assertEquals; 10 | import static org.junit.jupiter.api.Assertions.assertNotNull; 11 | 12 | public class RedisClientCacheTest { 13 | 14 | @BeforeAll 15 | public static void start() throws Exception { 16 | RedisClientCache.connect(); 17 | } 18 | 19 | @AfterAll 20 | public static void stop() { 21 | RedisClientCache.disconnect(); 22 | } 23 | 24 | @Test 25 | public void testRESPWithInfinispan() { 26 | assertNotNull(jedis); 27 | manipulateWithRESP(); 28 | assertEquals("world", jedis.get("Hello")); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /infinispan-remote/security/secured-cache/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/infinispan-remote/security/secured-cache/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /infinispan-remote/security/secured-cache/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 3 | -------------------------------------------------------------------------------- /infinispan-remote/security/secured-cache/src/main/resources/securedCache.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /infinispan-remote/security/secured-cache/src/test/java/org/infinispan/tutorial/simple/remote/InfinispanAuthorizationCacheTest.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.remote; 2 | 3 | import org.junit.jupiter.api.AfterAll; 4 | import org.junit.jupiter.api.BeforeAll; 5 | import org.junit.jupiter.api.Test; 6 | 7 | import static org.junit.jupiter.api.Assertions.assertEquals; 8 | import static org.junit.jupiter.api.Assertions.assertNotNull; 9 | import static org.junit.jupiter.api.Assertions.assertTrue; 10 | 11 | public class InfinispanAuthorizationCacheTest { 12 | 13 | @BeforeAll 14 | public static void start() throws Exception { 15 | InfinispanAuthorizationCache.connectToInfinispan(); 16 | } 17 | 18 | @AfterAll 19 | public static void stop() { 20 | InfinispanAuthorizationCache.disconnect(true); 21 | } 22 | 23 | @Test 24 | public void testInfinispanAuthorizationCache() { 25 | assertNotNull(InfinispanAuthorizationCache.cacheManager); 26 | assertNotNull(InfinispanAuthorizationCache.cache); 27 | assertNotNull(InfinispanAuthorizationCache.securedCache); 28 | 29 | InfinispanAuthorizationCache.manipulateCache(); 30 | 31 | assertTrue(InfinispanAuthorizationCache.message.contains("unauthorized")); 32 | } 33 | 34 | } -------------------------------------------------------------------------------- /infinispan-remote/security/tls-authorization/.gitignore: -------------------------------------------------------------------------------- 1 | *.csr 2 | *.cer 3 | *.p12 4 | *.pfx 5 | -------------------------------------------------------------------------------- /infinispan-remote/security/tls-authorization/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/infinispan-remote/security/tls-authorization/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /infinispan-remote/security/tls-authorization/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 3 | -------------------------------------------------------------------------------- /infinispan-remote/security/tls-authorization/clean_certs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Remove all generated TLS-related artifacts (certs, keystores, etc) 4 | rm *.cer 5 | rm *.csr 6 | rm *.p12 7 | rm *.pfx 8 | -------------------------------------------------------------------------------- /infinispan-remote/security/tls-authorization/create_signed_server_truststore_auth.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -f ${JAVA_HOME}/bin/keytool ] ; then 4 | # Maven uses JAVA_HOME to compile the project. If keytool bin is there, use it instead 5 | KEYTOOL_CMD="${JAVA_HOME}/bin/keytool" 6 | else 7 | # Otherwise, uses the keytool defined in path. 8 | KEYTOOL_CMD="keytool" 9 | fi 10 | 11 | # First create a server trust store using create-signed_certificates.sh 12 | # Make a copy of the server trust store 13 | cp server_truststore.p12 server_truststoreAuth.p12 14 | 15 | # Import the client certificate into the server trust store 16 | # This is necessary if you use client certificate authentication 17 | ${KEYTOOL_CMD} -importcert -alias client1 -keystore server_truststoreAuth.p12 -file client1.cer -storepass ServerTrustsecret -noprompt 18 | ${KEYTOOL_CMD} -importcert -alias client2 -keystore server_truststoreAuth.p12 -file client2.cer -storepass ServerTrustsecret -noprompt 19 | -------------------------------------------------------------------------------- /infinispan-remote/spatial-queries/src/main/java/org/infinispan/tutorial/simple/remote/spatial/Hiking.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.remote.spatial; 2 | 3 | import org.infinispan.api.annotations.indexing.GeoField; 4 | import org.infinispan.api.annotations.indexing.Indexed; 5 | import org.infinispan.api.annotations.indexing.Keyword; 6 | import org.infinispan.commons.api.query.geo.LatLng; 7 | import org.infinispan.protostream.annotations.Proto; 8 | 9 | @Proto 10 | @Indexed 11 | public record Hiking(@Keyword String name, @GeoField LatLng start, @GeoField LatLng end) { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /infinispan-remote/spatial-queries/src/main/java/org/infinispan/tutorial/simple/remote/spatial/Restaurant.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.remote.spatial; 2 | 3 | import org.infinispan.api.annotations.indexing.Basic; 4 | import org.infinispan.api.annotations.indexing.GeoPoint; 5 | import org.infinispan.api.annotations.indexing.Indexed; 6 | import org.infinispan.api.annotations.indexing.Keyword; 7 | import org.infinispan.api.annotations.indexing.Latitude; 8 | import org.infinispan.api.annotations.indexing.Longitude; 9 | import org.infinispan.api.annotations.indexing.Text; 10 | import org.infinispan.protostream.annotations.Proto; 11 | 12 | @Proto 13 | @Indexed 14 | @GeoPoint(fieldName = "location", projectable = true, sortable = true) 15 | public record Restaurant( 16 | @Keyword(normalizer = "lowercase", projectable = true, sortable = true) String name, 17 | @Text String description, 18 | @Text String address, 19 | @Latitude(fieldName = "location") Double latitude, 20 | @Longitude(fieldName = "location") Double longitude, 21 | @Basic Float score 22 | ) { 23 | } 24 | -------------------------------------------------------------------------------- /infinispan-remote/spatial-queries/src/main/java/org/infinispan/tutorial/simple/remote/spatial/TrainRoute.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.remote.spatial; 2 | 3 | import org.infinispan.api.annotations.indexing.GeoPoint; 4 | import org.infinispan.api.annotations.indexing.Indexed; 5 | import org.infinispan.api.annotations.indexing.Keyword; 6 | import org.infinispan.api.annotations.indexing.Latitude; 7 | import org.infinispan.api.annotations.indexing.Longitude; 8 | import org.infinispan.protostream.annotations.Proto; 9 | 10 | @Proto 11 | @Indexed 12 | @GeoPoint(fieldName = "departure", projectable = true, sortable = true) 13 | @GeoPoint(fieldName = "arrival", projectable = true, sortable = true) 14 | public record TrainRoute( 15 | @Keyword(normalizer = "lowercase") String name, 16 | @Latitude(fieldName = "departure") Double departureLat, 17 | @Longitude(fieldName = "departure") Double departureLon, 18 | @Latitude(fieldName = "arrival") Double arrivalLat, 19 | @Longitude(fieldName = "arrival") Double arrivalLon 20 | ) { 21 | } 22 | -------------------------------------------------------------------------------- /infinispan-remote/spatial-queries/src/main/java/org/infinispan/tutorial/simple/remote/spatial/TutorialSchema.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.remote.spatial; 2 | 3 | import org.infinispan.commons.api.query.geo.LatLng; 4 | import org.infinispan.protostream.GeneratedSchema; 5 | import org.infinispan.protostream.annotations.ProtoSchema; 6 | import org.infinispan.protostream.annotations.ProtoSyntax; 7 | 8 | @ProtoSchema(schemaPackageName = "tutorial", 9 | includeClasses = { Restaurant.class, TrainRoute.class, Hiking.class }, 10 | dependsOn = LatLng.LatLngSchema.class, // this is required to use LatLng 11 | syntax = ProtoSyntax.PROTO3) 12 | public interface TutorialSchema extends GeneratedSchema { 13 | } 14 | -------------------------------------------------------------------------------- /infinispan-remote/spatial-queries/src/main/resources/indexedCache.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | tutorial.Hiking 9 | tutorial.Restaurant 10 | tutorial.TrainRoute 11 | 12 | 13 | -------------------------------------------------------------------------------- /infinispan-remote/tasks/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/infinispan-remote/tasks/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /infinispan-remote/tasks/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 3 | -------------------------------------------------------------------------------- /infinispan-remote/tasks/src/main/resources/hello.js: -------------------------------------------------------------------------------- 1 | // mode=local,language=javascript,parameters=[greetee] 2 | "Hello " + greetee 3 | -------------------------------------------------------------------------------- /infinispan-remote/transactions/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/infinispan-remote/transactions/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /infinispan-remote/transactions/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 3 | -------------------------------------------------------------------------------- /infinispan-remote/transactions/src/main/resources/simple-tx-cache.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /infinispan-remote/transactions/src/test/java/org/infinispan/tutorial/simple/remote/transaction/InfinispanRemoteTxTest.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.remote.transaction; 2 | 3 | 4 | import org.junit.jupiter.api.AfterAll; 5 | import org.junit.jupiter.api.BeforeAll; 6 | import org.junit.jupiter.api.Test; 7 | 8 | import static org.infinispan.tutorial.simple.remote.transaction.InfinispanRemoteTx.cache; 9 | import static org.infinispan.tutorial.simple.remote.transaction.InfinispanRemoteTx.cacheManager; 10 | import static org.infinispan.tutorial.simple.remote.transaction.InfinispanRemoteTx.connectToInfinispan; 11 | import static org.infinispan.tutorial.simple.remote.transaction.InfinispanRemoteTx.disconnect; 12 | import static org.junit.jupiter.api.Assertions.assertEquals; 13 | import static org.junit.jupiter.api.Assertions.assertNotNull; 14 | 15 | public class InfinispanRemoteTxTest { 16 | 17 | @BeforeAll 18 | public static void start() throws Exception { 19 | connectToInfinispan(); 20 | } 21 | 22 | @AfterAll 23 | public static void stop() { 24 | disconnect(true); 25 | } 26 | 27 | @Test 28 | public void testTransactions() throws Exception { 29 | assertNotNull(cacheManager); 30 | assertNotNull(cache); 31 | 32 | InfinispanRemoteTx.manipulateWithTx(); 33 | 34 | assertEquals("value1", cache.get("key1")); 35 | assertEquals("value2", cache.get("key2")); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /integrations/hibernate/local/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/integrations/hibernate/local/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /integrations/hibernate/local/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 3 | -------------------------------------------------------------------------------- /integrations/hibernate/local/src/main/java/org/infinispan/tutorial/simple/hibernate/cache/local/model/Event.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate, Relational Persistence for Idiomatic Java 3 | * 4 | * License: GNU Lesser General Public License (LGPL), version 2.1 or later. 5 | * See the lgpl.txt file in the root directory or . 6 | */ 7 | package org.infinispan.tutorial.simple.hibernate.cache.local.model; 8 | 9 | import java.time.LocalDateTime; 10 | 11 | import jakarta.persistence.Cacheable; 12 | import jakarta.persistence.Entity; 13 | import jakarta.persistence.GeneratedValue; 14 | import jakarta.persistence.Id; 15 | 16 | @Entity 17 | @Cacheable 18 | public class Event { 19 | 20 | @Id 21 | @GeneratedValue 22 | private Long id; 23 | 24 | private String name; 25 | 26 | private LocalDateTime timestamp = LocalDateTime.now(); 27 | 28 | public Event(String name) { 29 | this.name = name; 30 | } 31 | 32 | public Event() { 33 | } 34 | 35 | public Long getId() { 36 | return id; 37 | } 38 | 39 | public void setId(Long id) { 40 | this.id = id; 41 | } 42 | 43 | public String getName() { 44 | return name; 45 | } 46 | 47 | public void setName(String name) { 48 | this.name = name; 49 | } 50 | 51 | public LocalDateTime getTimestamp() { 52 | return timestamp; 53 | } 54 | 55 | public void setTimestamp(LocalDateTime timestamp) { 56 | this.timestamp = timestamp; 57 | } 58 | 59 | @Override 60 | public String toString() { 61 | return "Event{" + 62 | "id=" + id + 63 | ", name='" + name + '\'' + 64 | ", time=" + timestamp + 65 | '}'; 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /integrations/hibernate/local/src/main/java/org/infinispan/tutorial/simple/hibernate/cache/local/model/Person.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.hibernate.cache.local.model; 2 | 3 | import jakarta.persistence.Cacheable; 4 | import jakarta.persistence.Entity; 5 | import jakarta.persistence.GeneratedValue; 6 | import jakarta.persistence.Id; 7 | 8 | @Entity 9 | @Cacheable 10 | public class Person { 11 | 12 | @Id 13 | @GeneratedValue 14 | private Long id; 15 | private String name; 16 | 17 | public Person(String name) { 18 | this.name = name; 19 | } 20 | 21 | public Person() { 22 | } 23 | 24 | public Long getId() { 25 | return id; 26 | } 27 | 28 | public void setId(Long id) { 29 | this.id = id; 30 | } 31 | 32 | public String getName() { 33 | return name; 34 | } 35 | 36 | public void setName(String firstName) { 37 | this.name = firstName; 38 | } 39 | 40 | @Override 41 | public String toString() { 42 | return "Person{" + 43 | "id=" + id + 44 | ", name='" + name + '\'' + 45 | '}'; 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /integrations/hibernate/local/src/main/resources/log4j2-tutorial.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /integrations/hibernate/spring-local/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/integrations/hibernate/spring-local/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /integrations/hibernate/spring-local/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 3 | -------------------------------------------------------------------------------- /integrations/hibernate/spring-local/src/main/java/org/infinispan/tutorial/simple/hibernate/cache/spring/local/model/Event.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate, Relational Persistence for Idiomatic Java 3 | * 4 | * License: GNU Lesser General Public License (LGPL), version 2.1 or later. 5 | * See the lgpl.txt file in the root directory or . 6 | */ 7 | package org.infinispan.tutorial.simple.hibernate.cache.spring.local.model; 8 | 9 | import jakarta.persistence.Cacheable; 10 | import jakarta.persistence.Entity; 11 | import jakarta.persistence.GeneratedValue; 12 | import jakarta.persistence.Id; 13 | import java.time.LocalDateTime; 14 | 15 | @Entity 16 | @Cacheable 17 | public class Event { 18 | 19 | @Id 20 | @GeneratedValue 21 | private Long id; 22 | 23 | private String name; 24 | 25 | private LocalDateTime timestamp = LocalDateTime.now(); 26 | 27 | public Event(String name) { 28 | this.name = name; 29 | } 30 | 31 | public Event() { 32 | } 33 | 34 | public Long getId() { 35 | return id; 36 | } 37 | 38 | public void setId(Long id) { 39 | this.id = 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 | public LocalDateTime getTimestamp() { 51 | return timestamp; 52 | } 53 | 54 | public void setTimestamp(LocalDateTime timestamp) { 55 | this.timestamp = timestamp; 56 | } 57 | 58 | @Override 59 | public String toString() { 60 | return "Event{" + 61 | "id=" + id + 62 | ", name='" + name + '\'' + 63 | ", time=" + timestamp + 64 | '}'; 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /integrations/hibernate/spring-local/src/main/java/org/infinispan/tutorial/simple/hibernate/cache/spring/local/model/Person.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.hibernate.cache.spring.local.model; 2 | 3 | import jakarta.persistence.Cacheable; 4 | import jakarta.persistence.Entity; 5 | import jakarta.persistence.GeneratedValue; 6 | import jakarta.persistence.Id; 7 | 8 | @Entity 9 | @Cacheable 10 | public class Person { 11 | 12 | @Id 13 | @GeneratedValue 14 | private Long id; 15 | private String name; 16 | 17 | public Person(String name) { 18 | this.name = name; 19 | } 20 | 21 | public Person() { 22 | } 23 | 24 | public Long getId() { 25 | return id; 26 | } 27 | 28 | public void setId(Long id) { 29 | this.id = id; 30 | } 31 | 32 | public String getName() { 33 | return name; 34 | } 35 | 36 | public void setName(String firstName) { 37 | this.name = firstName; 38 | } 39 | 40 | @Override 41 | public String toString() { 42 | return "Person{" + 43 | "id=" + id + 44 | ", name='" + name + '\'' + 45 | '}'; 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /integrations/hibernate/spring-local/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | # Enable those entities marked with @Cacheable to be cached 2 | spring.jpa.properties.javax.persistence.sharedCache.mode=ENABLE_SELECTIVE 3 | # Enables second level cache 4 | spring.jpa.properties.hibernate.cache.use_second_level_cache=true 5 | # Enable query cache 6 | spring.jpa.properties.hibernate.cache.use_query_cache=true 7 | 8 | # Use Infinispan second level cache provider 9 | spring.jpa.properties.hibernate.cache.region.factory_class=infinispan 10 | # Force using local configuration when only using a single node. 11 | # Otherwise a clustered configuration is loaded. 12 | spring.jpa.properties.hibernate.cache.infinispan.cfg=org/infinispan/hibernate/cache/commons/builder/infinispan-configs-local.xml 13 | 14 | # Entity specific configuration, e.g. via property: 15 | # hibernate.cache.infinispan..expiration.max_idle 16 | spring.jpa.properties.hibernate.cache.infinispan.org.infinispan.tutorial.simple.hibernate.cache.spring.local.model.Person.expiration.max_idle=1000 17 | 18 | # Generate statistics to see effects of second level cache 19 | spring.jpa.properties.hibernate.generate_statistics=true 20 | # Make session metrics/statistics logging less noisy 21 | logging.level.org.hibernate.engine.internal.StatisticalLoggingSessionEventListener=ERROR 22 | -------------------------------------------------------------------------------- /integrations/hibernate/wildfly-local/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/integrations/hibernate/wildfly-local/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /integrations/hibernate/wildfly-local/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 3 | -------------------------------------------------------------------------------- /integrations/hibernate/wildfly-local/src/main/java/org/infinispan/tutorial/simple/hibernate/cache/wildfly/local/model/Event.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate, Relational Persistence for Idiomatic Java 3 | * 4 | * License: GNU Lesser General Public License (LGPL), version 2.1 or later. 5 | * See the lgpl.txt file in the root directory or . 6 | */ 7 | package org.infinispan.tutorial.simple.hibernate.cache.wildfly.local.model; 8 | 9 | import javax.persistence.Cacheable; 10 | import javax.persistence.Entity; 11 | import javax.persistence.GeneratedValue; 12 | import javax.persistence.Id; 13 | import java.time.LocalDateTime; 14 | 15 | @Entity 16 | @Cacheable 17 | public class Event { 18 | 19 | @Id 20 | @GeneratedValue 21 | private Long id; 22 | 23 | private String name; 24 | 25 | private LocalDateTime timestamp = LocalDateTime.now(); 26 | 27 | public Event(String name) { 28 | this.name = name; 29 | } 30 | 31 | public Event() { 32 | } 33 | 34 | public Long getId() { 35 | return id; 36 | } 37 | 38 | public void setId(Long id) { 39 | this.id = 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 | public LocalDateTime getTimestamp() { 51 | return timestamp; 52 | } 53 | 54 | public void setTimestamp(LocalDateTime timestamp) { 55 | this.timestamp = timestamp; 56 | } 57 | 58 | @Override 59 | public String toString() { 60 | return "Event{" + 61 | "id=" + id + 62 | ", name='" + name + '\'' + 63 | ", time=" + timestamp + 64 | '}'; 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /integrations/hibernate/wildfly-local/src/main/java/org/infinispan/tutorial/simple/hibernate/cache/wildfly/local/model/Person.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.hibernate.cache.wildfly.local.model; 2 | 3 | import javax.persistence.Cacheable; 4 | import javax.persistence.Entity; 5 | import javax.persistence.GeneratedValue; 6 | import javax.persistence.Id; 7 | 8 | @Entity 9 | @Cacheable 10 | public class Person { 11 | 12 | @Id 13 | @GeneratedValue 14 | private Long id; 15 | private String name; 16 | 17 | public Person(String name) { 18 | this.name = name; 19 | } 20 | 21 | public Person() { 22 | } 23 | 24 | public Long getId() { 25 | return id; 26 | } 27 | 28 | public void setId(Long id) { 29 | this.id = id; 30 | } 31 | 32 | public String getName() { 33 | return name; 34 | } 35 | 36 | public void setName(String firstName) { 37 | this.name = firstName; 38 | } 39 | 40 | @Override 41 | public String toString() { 42 | return "Person{" + 43 | "id=" + id + 44 | ", name='" + name + '\'' + 45 | '}'; 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /integrations/hibernate/wildfly-local/src/main/java/org/infinispan/tutorial/simple/hibernate/cache/wildfly/local/util/ClearStatistics.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.hibernate.cache.wildfly.local.util; 2 | 3 | import org.hibernate.Session; 4 | 5 | import javax.inject.Inject; 6 | import javax.interceptor.AroundInvoke; 7 | import javax.interceptor.InvocationContext; 8 | import javax.persistence.EntityManager; 9 | 10 | public class ClearStatistics { 11 | 12 | @Inject 13 | private EntityManager em; 14 | 15 | @AroundInvoke 16 | public Object clearStatistics(InvocationContext ic) throws Exception { 17 | em.unwrap(Session.class).getSessionFactory().getStatistics().clear(); 18 | return ic.proceed(); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /integrations/hibernate/wildfly-local/src/main/java/org/infinispan/tutorial/simple/hibernate/cache/wildfly/local/util/Resources.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.hibernate.cache.wildfly.local.util; 2 | 3 | import javax.enterprise.inject.Produces; 4 | import javax.enterprise.inject.spi.InjectionPoint; 5 | import javax.persistence.EntityManager; 6 | import javax.persistence.PersistenceContext; 7 | import java.util.logging.Logger; 8 | 9 | /** 10 | * This class uses CDI to alias Java EE resources, such as the persistence context, to CDI beans 11 | *

12 | *

13 | * Example injection on a managed bean field: 14 | *

15 | *

16 | *

17 |  * @Inject
18 |  * private EntityManager em;
19 |  * 
20 | */ 21 | public class Resources { 22 | 23 | @Produces 24 | @PersistenceContext 25 | private EntityManager em; 26 | 27 | @Produces 28 | public Logger produceLog(InjectionPoint injectionPoint) { 29 | return Logger.getLogger(injectionPoint.getMember().getDeclaringClass().getName()); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /integrations/hibernate/wildfly-local/src/main/resources/META-INF/persistence.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | java:jboss/datasources/ExampleDS 9 | ENABLE_SELECTIVE 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 26 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /integrations/hibernate/wildfly-local/src/main/webapp/WEB-INF/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 24 | 25 | -------------------------------------------------------------------------------- /integrations/hibernate/wildfly-local/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | javax.ws.rs.core.Application 6 | /infinispan/* 7 | 8 | 9 | -------------------------------------------------------------------------------- /integrations/spring-boot/cache-embedded/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/integrations/spring-boot/cache-embedded/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /integrations/spring-boot/cache-embedded/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 3 | -------------------------------------------------------------------------------- /integrations/spring-boot/cache-embedded/src/main/java/org/infinispan/tutorial/simple/spring/embedded/BasqueName.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.spring.embedded; 2 | 3 | import java.io.Serializable; 4 | import java.util.Objects; 5 | 6 | public class BasqueName implements Serializable { 7 | 8 | private final int id; 9 | private final String name; 10 | 11 | public BasqueName(int id, String name) { 12 | this.id = id; 13 | this.name = name; 14 | } 15 | 16 | public int getId() { 17 | return id; 18 | } 19 | 20 | public String getName() { 21 | return this.name; 22 | } 23 | 24 | @Override 25 | public boolean equals(Object o) { 26 | return Objects.deepEquals(o, this); 27 | } 28 | 29 | @Override 30 | public int hashCode() { 31 | return Objects.hash(id, name); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /integrations/spring-boot/cache-embedded/src/main/java/org/infinispan/tutorial/simple/spring/embedded/BasqueNamesCachingApp.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.spring.embedded; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cache.annotation.EnableCaching; 6 | import org.springframework.scheduling.annotation.EnableScheduling; 7 | 8 | @SpringBootApplication 9 | @EnableCaching 10 | @EnableScheduling 11 | public class BasqueNamesCachingApp { 12 | 13 | public static void main(String[] args) { 14 | SpringApplication.run(BasqueNamesCachingApp.class); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /integrations/spring-boot/cache-embedded/src/main/java/org/infinispan/tutorial/simple/spring/embedded/BasqueNamesRepository.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.spring.embedded; 2 | 3 | import java.lang.invoke.MethodHandles; 4 | import java.util.logging.Logger; 5 | 6 | import org.springframework.cache.annotation.CacheConfig; 7 | import org.springframework.cache.annotation.Cacheable; 8 | import org.springframework.stereotype.Component; 9 | 10 | @Component 11 | @CacheConfig(cacheNames = Data.BASQUE_NAMES_CACHE) 12 | public class BasqueNamesRepository { 13 | 14 | private static final Logger logger = Logger.getLogger(MethodHandles.lookup().lookupClass().getName()); 15 | 16 | @Cacheable 17 | public BasqueName findById(int id) { 18 | logger.info("Call database to retrieve name by id '" + id + "'"); 19 | return new BasqueName(id, Data.NAMES.get(id)); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /integrations/spring-boot/cache-embedded/src/main/java/org/infinispan/tutorial/simple/spring/embedded/Data.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.spring.embedded; 2 | 3 | import java.util.Arrays; 4 | import java.util.List; 5 | 6 | public final class Data { 7 | public static final String BASQUE_NAMES_CACHE = "basque-names"; 8 | 9 | public static final List NAMES = Arrays.asList( 10 | "Aitor", "Ander", "Andoni", "Asier", "Eneko", "Gorka", "Koldo", "Mattin", "Xabier", 11 | "Galder", "Iker", "Unai", "Jon", "Markel", "Hodei", "Kepa", "Gaizka", "Imanol", 12 | "Amaia", "Ane", "Arantxa", "Edurne", "Josune", "Maialen", "Maite", "Miren", "Leire", 13 | "Nekane", "Oihana", "Elaia", "Nahia", "Nerea", "Izaro", "Neskutz", "Itxaso" 14 | ); 15 | } 16 | -------------------------------------------------------------------------------- /integrations/spring-boot/cache-embedded/src/main/java/org/infinispan/tutorial/simple/spring/embedded/Reader.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.spring.embedded; 2 | 3 | import java.lang.invoke.MethodHandles; 4 | import java.util.Random; 5 | 6 | import org.infinispan.manager.EmbeddedCacheManager; 7 | import org.slf4j.Logger; 8 | import org.slf4j.LoggerFactory; 9 | import org.springframework.scheduling.annotation.Scheduled; 10 | import org.springframework.stereotype.Component; 11 | 12 | @Component 13 | public class Reader { 14 | 15 | private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); 16 | 17 | private final EmbeddedCacheManager cacheManager; 18 | private final BasqueNamesRepository repository; 19 | private final Random random; 20 | 21 | public Reader(BasqueNamesRepository repository, EmbeddedCacheManager embeddedCacheManager) { 22 | this.repository = repository; 23 | cacheManager = embeddedCacheManager; 24 | this.random = new Random(); 25 | } 26 | 27 | @Scheduled(fixedDelay = 2000) 28 | public void retrieveSize() { 29 | logger.info("Cache size " + cacheManager.getCache(Data.BASQUE_NAMES_CACHE).size()); 30 | } 31 | 32 | @Scheduled(fixedDelay = 1000) 33 | public void retrieveBasqueName() { 34 | int id = this.random.nextInt(Data.NAMES.size()); 35 | logger.info("Find name by id '" + id + "'"); 36 | this.repository.findById(id); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /integrations/spring-boot/cache-embedded/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | management.endpoints.health.show-details=always 2 | management.endpoints.web.exposure.include=* 3 | infinispan.embedded.config-xml=infinispan.xml -------------------------------------------------------------------------------- /integrations/spring-boot/cache-embedded/src/main/resources/infinispan.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /integrations/spring-boot/cache-remote-reactor/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/integrations/spring-boot/cache-remote-reactor/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /integrations/spring-boot/cache-remote-reactor/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 3 | -------------------------------------------------------------------------------- /integrations/spring-boot/cache-remote-reactor/src/main/java/org/infinispan/tutorial/simple/spring/remote/BasqueName.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.spring.remote; 2 | 3 | import org.infinispan.protostream.annotations.Proto; 4 | 5 | @Proto 6 | public record BasqueName(String id, String name) {} -------------------------------------------------------------------------------- /integrations/spring-boot/cache-remote-reactor/src/main/java/org/infinispan/tutorial/simple/spring/remote/BasqueNamesCachingApp.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.spring.remote; 2 | 3 | import org.infinispan.tutorial.simple.connect.TutorialsConnectorHelper; 4 | import org.springframework.boot.ExitCodeGenerator; 5 | import org.springframework.boot.SpringApplication; 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; 7 | import org.springframework.cache.annotation.EnableCaching; 8 | import org.springframework.context.ConfigurableApplicationContext; 9 | import org.springframework.scheduling.annotation.EnableScheduling; 10 | 11 | @SpringBootApplication 12 | @EnableCaching 13 | @EnableScheduling 14 | public class BasqueNamesCachingApp { 15 | 16 | private static ConfigurableApplicationContext ctx; 17 | 18 | public static void main(String... args) { 19 | TutorialsConnectorHelper.startInfinispanContainer(); 20 | if (TutorialsConnectorHelper.isContainerStarted()) { 21 | String[] actualArgs = new String[]{"infinispan.remote.server-list=127.0.0.1:" + TutorialsConnectorHelper.INFINISPAN_CONTAINER.getFirstMappedPort()}; 22 | ctx = SpringApplication.run(BasqueNamesCachingApp.class, actualArgs); 23 | } else { 24 | ctx = SpringApplication.run(BasqueNamesCachingApp.class, args); 25 | } 26 | } 27 | 28 | public static void exitApplication() { 29 | int staticExitCode = SpringApplication.exit(ctx, new ExitCodeGenerator() { 30 | 31 | @Override 32 | public int getExitCode() { 33 | TutorialsConnectorHelper.stopInfinispanContainer(); 34 | // no errors 35 | return 0; 36 | } 37 | }); 38 | 39 | System.out.println("Exit"); 40 | System.exit(staticExitCode); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /integrations/spring-boot/cache-remote-reactor/src/main/java/org/infinispan/tutorial/simple/spring/remote/BasqueNamesRepository.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.spring.remote; 2 | 3 | import java.lang.invoke.MethodHandles; 4 | import java.util.HashMap; 5 | import java.util.Map; 6 | import java.util.logging.Logger; 7 | 8 | import org.springframework.cache.annotation.CacheConfig; 9 | import org.springframework.cache.annotation.Cacheable; 10 | import org.springframework.stereotype.Component; 11 | import reactor.core.publisher.Mono; 12 | 13 | @Component 14 | @CacheConfig(cacheNames = Data.BASQUE_NAMES_CACHE) 15 | public class BasqueNamesRepository { 16 | 17 | private static final Logger logger = Logger.getLogger(MethodHandles.lookup().lookupClass().getName()); 18 | private static Map database = createDB(); 19 | 20 | @Cacheable 21 | public Mono findById(String id) { 22 | logger.info("Call database to FIND name by id '" + id + "'"); 23 | return Mono.fromCallable(() -> database.get(id)); 24 | } 25 | 26 | public int size() { 27 | return database.size(); 28 | } 29 | 30 | private static Map createDB() { 31 | Map names = new HashMap<>(); 32 | for (int i = 0; i < Data.NAMES.size(); i++) { 33 | String id = i + ""; 34 | names.put(id, new BasqueName(id, Data.NAMES.get(i))); 35 | } 36 | return names; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /integrations/spring-boot/cache-remote-reactor/src/main/java/org/infinispan/tutorial/simple/spring/remote/BasquesNamesSchemaBuilder.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.spring.remote; 2 | 3 | import org.infinispan.protostream.GeneratedSchema; 4 | import org.infinispan.protostream.annotations.ProtoSchema; 5 | 6 | @ProtoSchema(schemaPackageName = "tutorial", includeClasses = BasqueName.class) 7 | public interface BasquesNamesSchemaBuilder extends GeneratedSchema { 8 | } 9 | -------------------------------------------------------------------------------- /integrations/spring-boot/cache-remote-reactor/src/main/java/org/infinispan/tutorial/simple/spring/remote/Data.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.spring.remote; 2 | 3 | import java.util.Arrays; 4 | import java.util.List; 5 | 6 | public final class Data { 7 | public static final String BASQUE_NAMES_CACHE ="basque-names"; 8 | 9 | public static final List NAMES = Arrays.asList( 10 | "Aitor", "Ander", "Andoni", "Asier", "Eneko", "Gorka", "Koldo", "Mattin", "Xabier", 11 | "Galder", "Iker", "Unai", "Jon", "Markel", "Hodei", "Kepa", "Gaizka", "Imanol", 12 | "Amaia", "Ane", "Arantxa", "Edurne", "Josune", "Maialen", "Maite", "Miren", "Leire", 13 | "Nekane", "Oihana", "Elaia", "Nahia", "Nerea", "Izaro", "Neskutz", "Itxaso" 14 | ); 15 | } 16 | -------------------------------------------------------------------------------- /integrations/spring-boot/cache-remote-reactor/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | infinispan.remote.server-list=127.0.0.1:11222 2 | infinispan.remote.reactive=true 3 | -------------------------------------------------------------------------------- /integrations/spring-boot/cache-remote-reactor/src/main/resources/basquesNamesCache.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /integrations/spring-boot/cache-remote/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/integrations/spring-boot/cache-remote/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /integrations/spring-boot/cache-remote/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 3 | -------------------------------------------------------------------------------- /integrations/spring-boot/cache-remote/src/main/java/org/infinispan/tutorial/simple/spring/remote/BasqueName.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.spring.remote; 2 | 3 | import org.infinispan.protostream.annotations.Proto; 4 | 5 | @Proto 6 | public record BasqueName(String id, String name) {} -------------------------------------------------------------------------------- /integrations/spring-boot/cache-remote/src/main/java/org/infinispan/tutorial/simple/spring/remote/BasqueNamesCachingApp.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.spring.remote; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cache.annotation.EnableCaching; 6 | import org.springframework.scheduling.annotation.EnableScheduling; 7 | 8 | @SpringBootApplication 9 | @EnableCaching 10 | @EnableScheduling 11 | public class BasqueNamesCachingApp { 12 | 13 | public static void main(String... args) { 14 | SpringApplication.run(BasqueNamesCachingApp.class); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /integrations/spring-boot/cache-remote/src/main/java/org/infinispan/tutorial/simple/spring/remote/BasqueNamesRepository.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.spring.remote; 2 | 3 | import java.lang.invoke.MethodHandles; 4 | import java.util.HashMap; 5 | import java.util.List; 6 | import java.util.Map; 7 | import java.util.logging.Logger; 8 | 9 | import org.springframework.cache.annotation.CacheConfig; 10 | import org.springframework.cache.annotation.CacheEvict; 11 | import org.springframework.cache.annotation.Cacheable; 12 | import org.springframework.stereotype.Component; 13 | 14 | @Component 15 | @CacheConfig(cacheNames = Data.BASQUE_NAMES_CACHE) 16 | public class BasqueNamesRepository { 17 | 18 | private static final Logger logger = Logger.getLogger(MethodHandles.lookup().lookupClass().getName()); 19 | private Map database = new HashMap<>(); 20 | 21 | @Cacheable() 22 | public BasqueName findById(String id) { 23 | logger.info("Call database to FIND name by id '" + id + "'"); 24 | return database.get(id); 25 | } 26 | 27 | public void create(String id, String name) { 28 | logger.info("Call database to CREATE name by id '" + id + "'"); 29 | database.put(id, new BasqueName(id, name)); 30 | } 31 | 32 | @CacheEvict 33 | public void removeById(String id) { 34 | logger.info("Call database to REMOVE name by id '" + id + "'"); 35 | database.remove(id); 36 | } 37 | 38 | public int size() { 39 | return database.size(); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /integrations/spring-boot/cache-remote/src/main/java/org/infinispan/tutorial/simple/spring/remote/BasquesNamesSchemaBuilder.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.spring.remote; 2 | 3 | import org.infinispan.protostream.GeneratedSchema; 4 | import org.infinispan.protostream.annotations.ProtoSchema; 5 | 6 | @ProtoSchema(schemaPackageName = "tutorial", includeClasses = BasqueName.class) 7 | public interface BasquesNamesSchemaBuilder extends GeneratedSchema { 8 | } 9 | -------------------------------------------------------------------------------- /integrations/spring-boot/cache-remote/src/main/java/org/infinispan/tutorial/simple/spring/remote/Data.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.spring.remote; 2 | 3 | import java.util.Arrays; 4 | import java.util.List; 5 | 6 | public final class Data { 7 | public static final String BASQUE_NAMES_CACHE ="basque-names"; 8 | 9 | public static final List NAMES = Arrays.asList( 10 | "Aitor", "Ander", "Andoni", "Asier", "Eneko", "Gorka", "Koldo", "Mattin", "Xabier", 11 | "Galder", "Iker", "Unai", "Jon", "Markel", "Hodei", "Kepa", "Gaizka", "Imanol", 12 | "Amaia", "Ane", "Arantxa", "Edurne", "Josune", "Maialen", "Maite", "Miren", "Leire", 13 | "Nekane", "Oihana", "Elaia", "Nahia", "Nerea", "Izaro", "Neskutz", "Itxaso" 14 | ); 15 | } 16 | -------------------------------------------------------------------------------- /integrations/spring-boot/cache-remote/src/main/java/org/infinispan/tutorial/simple/spring/remote/InfinispanConfiguration.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.spring.remote; 2 | 3 | import org.infinispan.commons.marshall.ProtoStreamMarshaller; 4 | import org.infinispan.spring.starter.remote.InfinispanRemoteCacheCustomizer; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | import org.springframework.core.Ordered; 8 | import org.springframework.core.annotation.Order; 9 | 10 | import java.net.URI; 11 | import java.net.URISyntaxException; 12 | 13 | @Configuration 14 | public class InfinispanConfiguration { 15 | 16 | @Bean 17 | @Order(Ordered.HIGHEST_PRECEDENCE) 18 | public InfinispanRemoteCacheCustomizer caches() { 19 | return b -> { 20 | URI cacheConfigUri; 21 | try { 22 | cacheConfigUri = this.getClass().getClassLoader().getResource("basquesNamesCache.xml").toURI(); 23 | } catch (URISyntaxException e) { 24 | throw new RuntimeException(e); 25 | } 26 | 27 | b.remoteCache(Data.BASQUE_NAMES_CACHE) 28 | .configurationURI(cacheConfigUri); 29 | 30 | b.remoteCache(Data.BASQUE_NAMES_CACHE).marshaller(ProtoStreamMarshaller.class); 31 | 32 | // Add marshaller in the client, the class is generated from the interface in compile time 33 | b.addContextInitializer(new BasquesNamesSchemaBuilderImpl()); 34 | }; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /integrations/spring-boot/cache-remote/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | infinispan.remote.server-list=127.0.0.1:11222 2 | # activates statistics for actuator 3 | infinispan.remote.statistics=true 4 | infinispan.remote.jmx=true 5 | 6 | management.endpoints.web.exposure.include=* 7 | 8 | # Security settings. Comment these properties if you are using a non secured server 9 | infinispan.remote.auth-username=admin 10 | infinispan.remote.auth-password=password 11 | -------------------------------------------------------------------------------- /integrations/spring-boot/cache-remote/src/main/resources/basquesNamesCache.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /integrations/spring-boot/prometheus.yml: -------------------------------------------------------------------------------- 1 | global: 2 | scrape_interval: 15s 3 | scrape_timeout: 10s 4 | evaluation_interval: 15s 5 | alerting: 6 | alertmanagers: 7 | - static_configs: 8 | - targets: [] 9 | scheme: http 10 | timeout: 10s 11 | scrape_configs: 12 | - job_name: prometheus 13 | scrape_interval: 15s 14 | scrape_timeout: 10s 15 | metrics_path: /metrics 16 | scheme: http 17 | static_configs: 18 | - targets: 19 | - localhost:9090 20 | - job_name: spring-actuator 21 | scrape_interval: 15s 22 | scrape_timeout: 10s 23 | metrics_path: /actuator/prometheus 24 | scheme: http 25 | static_configs: 26 | - targets: ['host.docker.internal:8080'] # works on docker for mac and windows, linux https://github.com/docker/for-linux/issues/264 -------------------------------------------------------------------------------- /integrations/spring-boot/session-embedded/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/integrations/spring-boot/session-embedded/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /integrations/spring-boot/session-embedded/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 3 | -------------------------------------------------------------------------------- /integrations/spring-boot/session-embedded/src/main/java/org/infinispan/tutorial/simple/spring/session/UserSessionsApp.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.spring.session; 2 | 3 | import org.infinispan.configuration.cache.CacheMode; 4 | import org.infinispan.configuration.cache.Configuration; 5 | import org.infinispan.configuration.cache.ConfigurationBuilder; 6 | import org.infinispan.configuration.global.GlobalConfigurationBuilder; 7 | import org.infinispan.spring.embedded.session.configuration.EnableInfinispanEmbeddedHttpSession; 8 | import org.infinispan.spring.starter.embedded.InfinispanCacheConfigurer; 9 | import org.infinispan.spring.starter.embedded.InfinispanGlobalConfigurer; 10 | import org.springframework.boot.autoconfigure.SpringBootApplication; 11 | import org.springframework.boot.builder.SpringApplicationBuilder; 12 | import org.springframework.context.annotation.Bean; 13 | 14 | @EnableInfinispanEmbeddedHttpSession 15 | @SpringBootApplication 16 | public class UserSessionsApp { 17 | 18 | @Bean 19 | public InfinispanGlobalConfigurer globalCustomizer() { 20 | return () -> GlobalConfigurationBuilder 21 | .defaultClusteredBuilder() 22 | .metrics().gauges(false).histograms(false) 23 | .globalState().disable() 24 | .build(); 25 | } 26 | 27 | @Bean 28 | public InfinispanCacheConfigurer cacheConfigurer() { 29 | return manager -> { 30 | final Configuration ispnConfig = new ConfigurationBuilder() 31 | .clustering() 32 | .cacheMode(CacheMode.DIST_SYNC) 33 | .statistics().disable() 34 | .build(); 35 | 36 | 37 | manager.defineConfiguration("sessions", ispnConfig); 38 | }; 39 | } 40 | 41 | public static void main(String... args) { 42 | new SpringApplicationBuilder().sources(UserSessionsApp.class).run(args); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /integrations/spring-boot/session-remote/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/integrations/spring-boot/session-remote/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /integrations/spring-boot/session-remote/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 3 | -------------------------------------------------------------------------------- /integrations/spring-boot/session-remote/src/main/java/org/infinispan/tutorial/simple/spring/session/InfinispanConfiguration.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.spring.session; 2 | 3 | import org.infinispan.commons.marshall.ProtoStreamMarshaller; 4 | import org.infinispan.spring.starter.remote.InfinispanRemoteCacheCustomizer; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | import org.springframework.core.Ordered; 8 | import org.springframework.core.annotation.Order; 9 | 10 | import java.net.URI; 11 | import java.net.URISyntaxException; 12 | 13 | @Configuration 14 | public class InfinispanConfiguration { 15 | 16 | @Bean 17 | @Order(Ordered.HIGHEST_PRECEDENCE) 18 | public InfinispanRemoteCacheCustomizer caches() { 19 | return b -> { 20 | // Ask the server to create this cache on startup 21 | URI uri; 22 | try { 23 | uri = this.getClass().getClassLoader().getResource("sessionsCacheConfig.xml").toURI(); 24 | } catch (URISyntaxException e) { 25 | throw new RuntimeException(e); 26 | } 27 | 28 | b.remoteCache("sessions").configurationURI(uri); 29 | // Use protostream marshaller to serialize the sessions with Protobuf 30 | b.remoteCache("sessions").marshaller(ProtoStreamMarshaller.class); 31 | }; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /integrations/spring-boot/session-remote/src/main/java/org/infinispan/tutorial/simple/spring/session/UserSessionsApp.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.spring.session; 2 | 3 | import org.infinispan.spring.remote.session.configuration.EnableInfinispanRemoteHttpSession; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.boot.builder.SpringApplicationBuilder; 6 | 7 | @SpringBootApplication 8 | @EnableInfinispanRemoteHttpSession 9 | public class UserSessionsApp { 10 | 11 | public static void main(String... args) { 12 | new SpringApplicationBuilder().sources(UserSessionsApp.class).run(args); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /integrations/spring-boot/session-remote/src/main/java/org/infinispan/tutorial/simple/spring/session/WebController.java: -------------------------------------------------------------------------------- 1 | package org.infinispan.tutorial.simple.spring.session; 2 | 3 | import jakarta.servlet.http.HttpSession; 4 | import org.springframework.stereotype.Controller; 5 | import org.springframework.ui.Model; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | import org.springframework.web.bind.annotation.RequestParam; 8 | import org.springframework.web.bind.annotation.SessionAttributes; 9 | 10 | @Controller 11 | @SessionAttributes("greetings") 12 | public class WebController { 13 | 14 | @GetMapping("/greeting") 15 | public String greeting(@RequestParam(name = "name", required = false, defaultValue = "World") String name, 16 | Model model, HttpSession session) { 17 | model.addAttribute("name", name); 18 | model.addAttribute("latest", session.getAttribute("latest")); 19 | session.setAttribute("latest", name); 20 | return "greeting"; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /integrations/spring-boot/session-remote/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | infinispan.remote.server-list=127.0.0.1:11222 2 | 3 | # near caching 4 | infinispan.remote.near-cache-mode=INVALIDATED 5 | infinispan.remote.near-cache-max-entries=100 6 | 7 | # activates statistics for actuator 8 | infinispan.remote.statistics=true 9 | infinispan.remote.jmx=true 10 | 11 | management.endpoints.web.exposure.include=* 12 | 13 | # Security settings. Comment these properties if you are using a non secured server 14 | infinispan.remote.use-auth=true 15 | infinispan.remote.sasl-mechanism=DIGEST-MD5 16 | infinispan.remote.auth-realm=default 17 | infinispan.remote.auth-server-name=infinispan 18 | infinispan.remote.auth-username=admin 19 | infinispan.remote.auth-password=password 20 | -------------------------------------------------------------------------------- /integrations/spring-boot/session-remote/src/main/resources/sessionsCacheConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /integrations/spring-boot/session-remote/src/main/resources/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/integrations/spring-boot/session-remote/src/main/resources/static/favicon.ico -------------------------------------------------------------------------------- /integrations/spring-boot/session-remote/src/main/resources/static/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/integrations/spring-boot/session-remote/src/main/resources/static/images/logo.png -------------------------------------------------------------------------------- /integrations/spring-boot/session-remote/src/main/resources/templates/greeting.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Getting Started: Serving Web Content 5 | 6 | 7 | 8 |

9 |

10 | 11 | 12 | -------------------------------------------------------------------------------- /integrations/spring-boot/session-remote/src/main/resources/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Getting Started: Serving Web Content 5 | 6 | 7 | 8 |

Get your greeting here

9 | 10 | -------------------------------------------------------------------------------- /integrations/spring/spring-cache/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinispan/infinispan-simple-tutorials/19ef352ec612af8a38ff21f5cba1b8ec49d23f27/integrations/spring/spring-cache/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /integrations/spring/spring-cache/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 3 | -------------------------------------------------------------------------------- /non-java-clients/c#/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // Information about this assembly is defined by the following attributes. 5 | // Change them to the values specific to your project. 6 | 7 | [assembly: AssemblyTitle ("simple")] 8 | [assembly: AssemblyDescription ("")] 9 | [assembly: AssemblyConfiguration ("")] 10 | [assembly: AssemblyCompany ("")] 11 | [assembly: AssemblyProduct ("")] 12 | [assembly: AssemblyCopyright ("tst")] 13 | [assembly: AssemblyTrademark ("")] 14 | [assembly: AssemblyCulture ("")] 15 | 16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 19 | 20 | [assembly: AssemblyVersion ("1.0.*")] 21 | 22 | // The following attributes are used to specify the signing key for the assembly, 23 | // if desired. See the Mono documentation for more information about signing. 24 | 25 | //[assembly: AssemblyDelaySign(false)] 26 | //[assembly: AssemblyKeyFile("")] 27 | 28 | -------------------------------------------------------------------------------- /non-java-clients/c#/Simple.cs: -------------------------------------------------------------------------------- 1 | using Infinispan.HotRod.Impl; 2 | using Infinispan.HotRod.Config; 3 | using Infinispan.HotRod; 4 | using System; 5 | using System.IO; 6 | using System.Collections.Generic; 7 | using System.Threading; 8 | 9 | namespace Infinispan.Tutorial 10 | { 11 | public class Simple 12 | { 13 | static void Main() { 14 | // Create a configuration for a locally-running server 15 | ConfigurationBuilder builder = new ConfigurationBuilder(); 16 | Configuration conf = builder.AddServers("127.0.0.1:11222").Build(); 17 | // Initialize the remote cache manager 18 | RemoteCacheManager remoteManager = new RemoteCacheManager(conf); 19 | // Connect to the server 20 | remoteManager.Start(); 21 | // Store a value 22 | IRemoteCache cache=remoteManager.GetCache(); 23 | cache.Put("key", "value"); 24 | // Retrieve the value and print it out 25 | Console.WriteLine("key = {0}", cache.Get("key")); 26 | // Stop the cache manager and release all resources 27 | remoteManager.Stop(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /non-java-clients/c#/simple.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.24720.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "simple", "simple.csproj", "{60E4AF13-9935-4A89-B30A-1D344DB6D024}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Release|x64 = Release|x64 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {60E4AF13-9935-4A89-B30A-1D344DB6D024}.Debug|x64.ActiveCfg = Debug|x64 15 | {60E4AF13-9935-4A89-B30A-1D344DB6D024}.Debug|x64.Build.0 = Debug|x64 16 | {60E4AF13-9935-4A89-B30A-1D344DB6D024}.Release|x64.ActiveCfg = Release|x64 17 | {60E4AF13-9935-4A89-B30A-1D344DB6D024}.Release|x64.Build.0 = Release|x64 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(MonoDevelopProperties) = preSolution 23 | StartupItem = simple.csproj 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /non-java-clients/c++/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6) 2 | 3 | project(simple) 4 | 5 | set(DLLEXPORT_STATIC "HR_PROTO_EXPORT= ") 6 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") 7 | 8 | file(GLOB cpp_files "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp") 9 | 10 | include_directories(${CMAKE_CURRENT_BINARY_DIR}) 11 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 12 | 13 | add_executable(simple ${cpp_files}) 14 | 15 | set_target_properties(simple PROPERTIES COMPILE_DEFINITIONS "${DLLEXPORT_STATIC}") 16 | target_link_libraries(simple hotrod) 17 | -------------------------------------------------------------------------------- /non-java-clients/c++/src/simple.cpp: -------------------------------------------------------------------------------- 1 | #include "infinispan/hotrod/ConfigurationBuilder.h" 2 | #include "infinispan/hotrod/RemoteCacheManager.h" 3 | #include "infinispan/hotrod/RemoteCache.h" 4 | #include "infinispan/hotrod/Version.h" 5 | 6 | #include 7 | #include 8 | 9 | using namespace infinispan::hotrod; 10 | 11 | int main(int argc, char** argv) { 12 | // Create a configuration for a locally-running server 13 | ConfigurationBuilder builder; 14 | builder.addServer().host(argc > 1 ? argv[1] : "127.0.0.1").port(argc > 2 ? atoi(argv[2]) : 11222); 15 | // Initialize the remote cache manager 16 | RemoteCacheManager cacheManager(builder.build(), false); 17 | // Obtain the remote cache 18 | RemoteCache cache = cacheManager.getCache("default",false); 19 | // Connect to the server 20 | cacheManager.start(); 21 | // Store a value 22 | cache.put("key", "value"); 23 | // Retrieve the value and print it out 24 | std::cout << "key = " << *cache.get("key") << std::endl; 25 | // Stop the cache manager and release all resources 26 | cacheManager.stop(); 27 | return 0; 28 | } 29 | -------------------------------------------------------------------------------- /non-java-clients/node.js/index.js: -------------------------------------------------------------------------------- 1 | var infinispan = require('infinispan'); 2 | 3 | var connected = infinispan.client({port: 11222, host: '127.0.0.1'}, 4 | { 5 | cacheName: 'my-cache', 6 | clientIntelligence: 'BASIC', 7 | authentication: { 8 | enabled: true, 9 | saslMechanism: 'DIGEST-MD5', 10 | userName: 'admin', 11 | password: 'password' 12 | } 13 | } 14 | ); 15 | connected.then(function(client) { 16 | console.log("Connected"); 17 | var putGetPromise = client.put('key', 'value').then(function () { 18 | return client.get('key').then(function (value) { 19 | console.log('key = ' + value); 20 | }) 21 | }); 22 | 23 | return putGetPromise.finally(function() { 24 | // Regardless of the result, disconnect client 25 | return client.disconnect().then(function() { console.log("Disconnected") }); 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /non-java-clients/node.js/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "infinispan-simple-tutorials-js", 3 | "version": "0.0.1", 4 | "description": "Infinispan Javascript client simple tutorial", 5 | "main": "index.js", 6 | "author": "Galder Zamarreño", 7 | "license": "Apache-2.0", 8 | "repository": { 9 | "type": "git", 10 | "url": "https://github.com/infinispan/infinispan-simple-tutorials" 11 | }, 12 | "scripts": { 13 | "start": "node index.js" 14 | }, 15 | "dependencies": { 16 | "infinispan": "^0.9.0" 17 | } 18 | } 19 | --------------------------------------------------------------------------------