├── .trivyignore ├── py ├── requirements.txt ├── react-app │ ├── todos.png │ ├── asset-manifest.json │ ├── index.html │ └── static │ │ └── js │ │ └── main.5fafe4e7.js.LICENSE.txt └── README.md ├── js ├── public │ ├── todos.png │ └── index.html ├── src │ ├── static │ │ └── todos.png │ ├── .babelrc │ ├── setupTests.js │ ├── reducers │ │ ├── index.js │ │ └── todos.js │ ├── constants │ │ ├── TodoFilters.js │ │ └── ActionTypes.js │ ├── App.test.js │ ├── components │ │ ├── Header.js │ │ ├── TodoInput.js │ │ ├── TodoTextInput.js │ │ ├── TodoItem.js │ │ ├── MainSection.js │ │ └── Footer.js │ ├── index.css │ ├── App.js │ ├── App.css │ └── index.js ├── README.md └── package.json ├── assets ├── graphiql-ui.png ├── jet-client.png ├── javafx-client.png └── react-client.png ├── java ├── helidon-server │ ├── src │ │ ├── main │ │ │ ├── web │ │ │ │ ├── react │ │ │ │ │ ├── public │ │ │ │ │ │ ├── todos.png │ │ │ │ │ │ └── index.html │ │ │ │ │ ├── src │ │ │ │ │ │ ├── .babelrc │ │ │ │ │ │ ├── static │ │ │ │ │ │ │ └── todos.png │ │ │ │ │ │ ├── setupTests.js │ │ │ │ │ │ ├── reducers │ │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ │ └── todos.js │ │ │ │ │ │ ├── constants │ │ │ │ │ │ │ ├── TodoFilters.js │ │ │ │ │ │ │ └── ActionTypes.js │ │ │ │ │ │ ├── App.test.js │ │ │ │ │ │ ├── components │ │ │ │ │ │ │ ├── Header.js │ │ │ │ │ │ │ ├── TodoInput.js │ │ │ │ │ │ │ ├── TodoTextInput.js │ │ │ │ │ │ │ ├── TodoItem.js │ │ │ │ │ │ │ ├── MainSection.js │ │ │ │ │ │ │ └── Footer.js │ │ │ │ │ │ ├── index.css │ │ │ │ │ │ ├── App.js │ │ │ │ │ │ ├── App.css │ │ │ │ │ │ └── index.js │ │ │ │ │ └── package.json │ │ │ │ ├── jet │ │ │ │ │ ├── src │ │ │ │ │ │ └── css │ │ │ │ │ │ │ ├── images │ │ │ │ │ │ │ ├── favicon.ico │ │ │ │ │ │ │ ├── avatar_24px.png │ │ │ │ │ │ │ ├── avatar_24px_2x.png │ │ │ │ │ │ │ └── oracle_logo.svg │ │ │ │ │ │ │ ├── demo.css │ │ │ │ │ │ │ └── app.css │ │ │ │ │ ├── oraclejetconfig.json │ │ │ │ │ ├── package.json │ │ │ │ │ └── scripts │ │ │ │ │ │ └── hooks │ │ │ │ │ │ ├── after_app_create.js │ │ │ │ │ │ ├── after_app_restore.js │ │ │ │ │ │ ├── after_build.js │ │ │ │ │ │ ├── after_serve.js │ │ │ │ │ │ ├── after_watch.js │ │ │ │ │ │ ├── before_build.js │ │ │ │ │ │ ├── before_serve.js │ │ │ │ │ │ ├── before_watch.js │ │ │ │ │ │ ├── after_app_typescript.js │ │ │ │ │ │ ├── before_optimize.js │ │ │ │ │ │ ├── after_component_typescript.js │ │ │ │ │ │ ├── before_hybrid_build.js │ │ │ │ │ │ ├── before_release_build.js │ │ │ │ │ │ ├── after_component_build.js │ │ │ │ │ │ ├── before_component_optimize.js │ │ │ │ │ │ ├── after_component_create.js │ │ │ │ │ │ ├── before_app_typescript.js │ │ │ │ │ │ ├── before_component_typescript.js │ │ │ │ │ │ └── hooks.json │ │ │ │ └── graphql │ │ │ │ │ └── graphiql.html │ │ │ ├── resources │ │ │ │ ├── META-INF │ │ │ │ │ ├── type-aliases.properties │ │ │ │ │ ├── services │ │ │ │ │ │ └── io.helidon.grpc.core.MarshallerSupplier │ │ │ │ │ ├── beans.xml │ │ │ │ │ └── microprofile-config.properties │ │ │ │ ├── application.yaml │ │ │ │ ├── logging.properties │ │ │ │ └── pof-config.xml │ │ │ ├── k8s │ │ │ │ ├── jaeger.yaml │ │ │ │ ├── app.yaml │ │ │ │ └── ingress-nginx.yaml │ │ │ ├── microk8s │ │ │ │ ├── jaeger.yaml │ │ │ │ ├── app.yaml │ │ │ │ └── ingress-traefik.yaml │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── oracle │ │ │ │ └── coherence │ │ │ │ └── examples │ │ │ │ └── todo │ │ │ │ └── server │ │ │ │ ├── TaskRepository.java │ │ │ │ └── io │ │ │ │ └── MessagePofSerializer.java │ │ └── test │ │ │ └── java │ │ │ └── com │ │ │ └── oracle │ │ │ └── coherence │ │ │ └── examples │ │ │ └── todo │ │ │ └── server │ │ │ ├── TaskTest.java │ │ │ └── TodoListIT.java │ └── README.md ├── spring-server │ └── src │ │ ├── main │ │ ├── web │ │ │ └── react │ │ │ │ ├── public │ │ │ │ ├── todos.png │ │ │ │ └── index.html │ │ │ │ ├── src │ │ │ │ ├── .babelrc │ │ │ │ ├── static │ │ │ │ │ └── todos.png │ │ │ │ ├── setupTests.js │ │ │ │ ├── reducers │ │ │ │ │ ├── index.js │ │ │ │ │ └── todos.js │ │ │ │ ├── constants │ │ │ │ │ ├── TodoFilters.js │ │ │ │ │ └── ActionTypes.js │ │ │ │ ├── App.test.js │ │ │ │ ├── components │ │ │ │ │ ├── Header.js │ │ │ │ │ ├── TodoInput.js │ │ │ │ │ ├── TodoTextInput.js │ │ │ │ │ ├── TodoItem.js │ │ │ │ │ ├── MainSection.js │ │ │ │ │ └── Footer.js │ │ │ │ ├── index.css │ │ │ │ ├── App.js │ │ │ │ ├── App.css │ │ │ │ └── index.js │ │ │ │ └── package.json │ │ ├── resources │ │ │ ├── META-INF │ │ │ │ └── type-aliases.properties │ │ │ ├── application.yml │ │ │ ├── graphql │ │ │ │ └── schema.graphqls │ │ │ └── pof-config.xml │ │ ├── k8s │ │ │ ├── jaeger.yaml │ │ │ ├── app.yaml │ │ │ └── ingress-nginx.yaml │ │ └── java │ │ │ └── com │ │ │ └── oracle │ │ │ └── coherence │ │ │ └── examples │ │ │ └── todo │ │ │ └── server │ │ │ ├── config │ │ │ ├── GlobalControllerExceptionHandler.java │ │ │ └── WebConfig.java │ │ │ ├── TodoListSpringServerApplication.java │ │ │ ├── service │ │ │ ├── TaskService.java │ │ │ └── TaskNotFoundException.java │ │ │ ├── repository │ │ │ ├── SpringDataTaskRepository.java │ │ │ └── TaskRepository.java │ │ │ ├── graphql │ │ │ └── TaskQueryController.java │ │ │ └── serializer │ │ │ └── MessagePofSerializer.java │ │ └── test │ │ └── java │ │ └── com │ │ └── oracle │ │ └── coherence │ │ └── examples │ │ └── todo │ │ └── server │ │ ├── TodoListTests.java │ │ ├── CoherenceMetricsDisabledTests.java │ │ ├── BaseCoherenceMetricsTests.java │ │ └── CoherenceMetricsEnabledTests.java ├── micronaut-server │ ├── src │ │ ├── main │ │ │ ├── web │ │ │ │ └── react │ │ │ │ │ ├── public │ │ │ │ │ ├── todos.png │ │ │ │ │ └── index.html │ │ │ │ │ ├── src │ │ │ │ │ ├── .babelrc │ │ │ │ │ ├── static │ │ │ │ │ │ └── todos.png │ │ │ │ │ ├── setupTests.js │ │ │ │ │ ├── reducers │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── todos.js │ │ │ │ │ ├── constants │ │ │ │ │ │ ├── TodoFilters.js │ │ │ │ │ │ └── ActionTypes.js │ │ │ │ │ ├── App.test.js │ │ │ │ │ ├── components │ │ │ │ │ │ ├── Header.js │ │ │ │ │ │ ├── TodoInput.js │ │ │ │ │ │ ├── TodoTextInput.js │ │ │ │ │ │ ├── TodoItem.js │ │ │ │ │ │ ├── MainSection.js │ │ │ │ │ │ └── Footer.js │ │ │ │ │ ├── index.css │ │ │ │ │ ├── App.js │ │ │ │ │ ├── App.css │ │ │ │ │ └── index.js │ │ │ │ │ └── package.json │ │ │ ├── resources │ │ │ │ ├── META-INF │ │ │ │ │ └── type-aliases.properties │ │ │ │ ├── logback.xml │ │ │ │ ├── schema.graphqls │ │ │ │ └── application.yml │ │ │ ├── k8s │ │ │ │ ├── jaeger.yaml │ │ │ │ ├── app.yaml │ │ │ │ └── ingress-nginx.yaml │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── oracle │ │ │ │ └── coherence │ │ │ │ └── examples │ │ │ │ └── todo │ │ │ │ └── server │ │ │ │ ├── Application.java │ │ │ │ └── TaskRepository.java │ │ └── test │ │ │ └── java │ │ │ └── com │ │ │ └── oracle │ │ │ └── coherence │ │ │ └── examples │ │ │ └── todo │ │ │ └── server │ │ │ ├── TodoListIT.java │ │ │ └── MetricsIT.java │ └── README.md ├── .mvn │ └── wrapper │ │ └── maven-wrapper.properties ├── coherence-client │ └── src │ │ ├── main │ │ ├── resources │ │ │ ├── META-INF │ │ │ │ ├── type-aliases.properties │ │ │ │ └── beans.xml │ │ │ └── com │ │ │ │ └── oracle │ │ │ │ └── coherence │ │ │ │ └── examples │ │ │ │ └── todo │ │ │ │ └── client │ │ │ │ └── ToDoApplication.css │ │ └── java │ │ │ └── com │ │ │ └── oracle │ │ │ └── coherence │ │ │ └── examples │ │ │ └── todo │ │ │ └── client │ │ │ ├── TaskEvent.java │ │ │ └── javafxcdi │ │ │ ├── ResourceBundleProducer.java │ │ │ └── Bundle.java │ │ └── test │ │ └── java │ │ └── com │ │ └── oracle │ │ └── coherence │ │ └── examples │ │ └── todo │ │ └── client │ │ ├── TaskTest.java │ │ ├── ConsoleLogConsumer.java │ │ └── SystemPropertyExtension.java ├── coherence-server │ ├── src │ │ ├── main │ │ │ ├── resources │ │ │ │ └── META-INF │ │ │ │ │ └── type-aliases.properties │ │ │ ├── k8s │ │ │ │ ├── jaeger.yaml │ │ │ │ ├── ingress-nginx.yaml │ │ │ │ └── app.yaml │ │ │ ├── assembly │ │ │ │ └── image-assembly.xml │ │ │ └── docker │ │ │ │ └── Dockerfile │ │ └── test │ │ │ └── java │ │ │ └── com │ │ │ └── oracle │ │ │ └── coherence │ │ │ └── examples │ │ │ └── todo │ │ │ └── server │ │ │ └── TaskTest.java │ └── README.md ├── helidon-client │ └── src │ │ └── main │ │ ├── resources │ │ ├── META-INF │ │ │ ├── type-aliases.properties │ │ │ └── beans.xml │ │ ├── application.yaml │ │ ├── com │ │ │ └── oracle │ │ │ │ └── coherence │ │ │ │ └── examples │ │ │ │ └── todo │ │ │ │ └── client │ │ │ │ └── ToDoApplication.css │ │ └── pof-config.xml │ │ └── java │ │ └── com │ │ └── oracle │ │ └── coherence │ │ └── examples │ │ └── todo │ │ └── client │ │ ├── io │ │ └── MessagePofSerializer.java │ │ ├── TaskEvent.java │ │ └── javafxcdi │ │ ├── ResourceBundleProducer.java │ │ └── Bundle.java └── pom.xml ├── .github ├── dependabot.yml └── workflows │ ├── trivy-scan.yml │ └── build.yml ├── README.md ├── .gitignore ├── go ├── go.mod └── todo_test.go ├── bin └── test-fat-jar.sh └── LICENSE.txt /.trivyignore: -------------------------------------------------------------------------------- 1 | CVE-2025-25193 exp:2025-02-17 -------------------------------------------------------------------------------- /py/requirements.txt: -------------------------------------------------------------------------------- 1 | coherence-client==2.0.0 2 | Quart==0.20.0 3 | -------------------------------------------------------------------------------- /js/public/todos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coherence-community/todo-list-example/HEAD/js/public/todos.png -------------------------------------------------------------------------------- /assets/graphiql-ui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coherence-community/todo-list-example/HEAD/assets/graphiql-ui.png -------------------------------------------------------------------------------- /assets/jet-client.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coherence-community/todo-list-example/HEAD/assets/jet-client.png -------------------------------------------------------------------------------- /py/react-app/todos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coherence-community/todo-list-example/HEAD/py/react-app/todos.png -------------------------------------------------------------------------------- /assets/javafx-client.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coherence-community/todo-list-example/HEAD/assets/javafx-client.png -------------------------------------------------------------------------------- /assets/react-client.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coherence-community/todo-list-example/HEAD/assets/react-client.png -------------------------------------------------------------------------------- /js/src/static/todos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coherence-community/todo-list-example/HEAD/js/src/static/todos.png -------------------------------------------------------------------------------- /js/src/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": [ 3 | "@babel/plugin-proposal-class-properties", 4 | "@babel/plugin-proposal-object-rest-spread" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /java/helidon-server/src/main/web/react/public/todos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coherence-community/todo-list-example/HEAD/java/helidon-server/src/main/web/react/public/todos.png -------------------------------------------------------------------------------- /java/spring-server/src/main/web/react/public/todos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coherence-community/todo-list-example/HEAD/java/spring-server/src/main/web/react/public/todos.png -------------------------------------------------------------------------------- /java/helidon-server/src/main/web/react/src/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": [ 3 | "@babel/plugin-proposal-class-properties", 4 | "@babel/plugin-proposal-object-rest-spread" 5 | ] 6 | } -------------------------------------------------------------------------------- /java/micronaut-server/src/main/web/react/public/todos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coherence-community/todo-list-example/HEAD/java/micronaut-server/src/main/web/react/public/todos.png -------------------------------------------------------------------------------- /java/spring-server/src/main/web/react/src/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": [ 3 | "@babel/plugin-proposal-class-properties", 4 | "@babel/plugin-proposal-object-rest-spread" 5 | ] 6 | } -------------------------------------------------------------------------------- /java/helidon-server/src/main/web/react/src/static/todos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coherence-community/todo-list-example/HEAD/java/helidon-server/src/main/web/react/src/static/todos.png -------------------------------------------------------------------------------- /java/micronaut-server/src/main/web/react/src/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": [ 3 | "@babel/plugin-proposal-class-properties", 4 | "@babel/plugin-proposal-object-rest-spread" 5 | ] 6 | } -------------------------------------------------------------------------------- /java/spring-server/src/main/web/react/src/static/todos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coherence-community/todo-list-example/HEAD/java/spring-server/src/main/web/react/src/static/todos.png -------------------------------------------------------------------------------- /java/micronaut-server/src/main/web/react/src/static/todos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coherence-community/todo-list-example/HEAD/java/micronaut-server/src/main/web/react/src/static/todos.png -------------------------------------------------------------------------------- /java/helidon-server/src/main/web/jet/src/css/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coherence-community/todo-list-example/HEAD/java/helidon-server/src/main/web/jet/src/css/images/favicon.ico -------------------------------------------------------------------------------- /java/helidon-server/src/main/web/jet/src/css/images/avatar_24px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coherence-community/todo-list-example/HEAD/java/helidon-server/src/main/web/jet/src/css/images/avatar_24px.png -------------------------------------------------------------------------------- /java/helidon-server/src/main/web/jet/src/css/images/avatar_24px_2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coherence-community/todo-list-example/HEAD/java/helidon-server/src/main/web/jet/src/css/images/avatar_24px_2x.png -------------------------------------------------------------------------------- /java/helidon-server/src/main/web/jet/src/css/demo.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | -------------------------------------------------------------------------------- /java/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.5/apache-maven-3.8.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "github-actions" 4 | directory: "/" 5 | schedule: 6 | interval: "weekly" 7 | - package-ecosystem: "maven" 8 | directory: "/java" 9 | schedule: 10 | interval: "weekly" -------------------------------------------------------------------------------- /js/src/setupTests.js: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom/extend-expect'; 6 | -------------------------------------------------------------------------------- /py/react-app/asset-manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "files": { 3 | "main.js": "/static/js/main.5fafe4e7.js", 4 | "index.html": "/index.html", 5 | "main.5fafe4e7.js.map": "/static/js/main.5fafe4e7.js.map" 6 | }, 7 | "entrypoints": [ 8 | "static/js/main.5fafe4e7.js" 9 | ] 10 | } -------------------------------------------------------------------------------- /java/coherence-client/src/main/resources/META-INF/type-aliases.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2020 Oracle and/or its affiliates. 3 | # 4 | # Licensed under the Universal Permissive License v 1.0 as shown at 5 | # https://oss.oracle.com/licenses/upl. 6 | # 7 | 8 | Task=com.oracle.coherence.examples.todo.client.Task -------------------------------------------------------------------------------- /java/coherence-server/src/main/resources/META-INF/type-aliases.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2020 Oracle and/or its affiliates. 3 | # 4 | # Licensed under the Universal Permissive License v 1.0 as shown at 5 | # https://oss.oracle.com/licenses/upl. 6 | # 7 | 8 | Task=com.oracle.coherence.examples.todo.server.Task -------------------------------------------------------------------------------- /java/helidon-client/src/main/resources/META-INF/type-aliases.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2020 Oracle and/or its affiliates. 3 | # 4 | # Licensed under the Universal Permissive License v 1.0 as shown at 5 | # https://oss.oracle.com/licenses/upl. 6 | # 7 | 8 | Task=com.oracle.coherence.examples.todo.client.Task -------------------------------------------------------------------------------- /java/micronaut-server/src/main/resources/META-INF/type-aliases.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2020 Oracle and/or its affiliates. 3 | # 4 | # Licensed under the Universal Permissive License v 1.0 as shown at 5 | # https://oss.oracle.com/licenses/upl. 6 | # 7 | 8 | Task=com.oracle.coherence.examples.todo.server.Task -------------------------------------------------------------------------------- /java/helidon-server/src/main/resources/META-INF/type-aliases.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2020, 2021, Oracle and/or its affiliates. 3 | # 4 | # Licensed under the Universal Permissive License v 1.0 as shown at 5 | # https://oss.oracle.com/licenses/upl. 6 | # 7 | 8 | Task=com.oracle.coherence.examples.todo.server.Task -------------------------------------------------------------------------------- /java/spring-server/src/main/resources/META-INF/type-aliases.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2021 Oracle and/or its affiliates. 3 | # 4 | # Licensed under the Universal Permissive License v 1.0 as shown at 5 | # https://oss.oracle.com/licenses/upl. 6 | # 7 | 8 | Task=com.oracle.coherence.examples.todo.server.model.Task -------------------------------------------------------------------------------- /java/helidon-server/src/main/web/react/src/setupTests.js: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom/extend-expect'; 6 | -------------------------------------------------------------------------------- /java/micronaut-server/src/main/web/react/src/setupTests.js: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom/extend-expect'; 6 | -------------------------------------------------------------------------------- /java/spring-server/src/main/web/react/src/setupTests.js: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom/extend-expect'; 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### Coherence Task Management Examples Repository 2 | 3 | This repository contains a set of simple task management examples written in various languages to showcase Coherence CE. 4 | 5 | Examples in languages other than Java may rely upon parts of the Java example. See the READMEs in each language 6 | directory for more detail. 7 | -------------------------------------------------------------------------------- /js/src/reducers/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | import { combineReducers } from 'redux' 9 | import todos from './todos' 10 | 11 | export default combineReducers({todos}); 12 | -------------------------------------------------------------------------------- /java/coherence-server/src/main/k8s/jaeger.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2020, 2021, Oracle and/or its affiliates. 3 | # 4 | # Licensed under the Universal Permissive License v 1.0 as shown at 5 | # http://oss.oracle.com/licenses/upl. 6 | # 7 | apiVersion: jaegertracing.io/v1 8 | kind: Jaeger 9 | metadata: 10 | name: jaeger 11 | spec: 12 | ingress: 13 | enabled: false -------------------------------------------------------------------------------- /java/helidon-server/src/main/k8s/jaeger.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2020, 2021, Oracle and/or its affiliates. 3 | # 4 | # Licensed under the Universal Permissive License v 1.0 as shown at 5 | # http://oss.oracle.com/licenses/upl. 6 | # 7 | apiVersion: jaegertracing.io/v1 8 | kind: Jaeger 9 | metadata: 10 | name: jaeger 11 | spec: 12 | ingress: 13 | enabled: false -------------------------------------------------------------------------------- /java/micronaut-server/src/main/k8s/jaeger.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2020 Oracle and/or its affiliates. 3 | # 4 | # Licensed under the Universal Permissive License v 1.0 as shown at 5 | # http://oss.oracle.com/licenses/upl. 6 | # 7 | apiVersion: jaegertracing.io/v1 8 | kind: Jaeger 9 | metadata: 10 | name: jaeger 11 | spec: 12 | ingress: 13 | enabled: false 14 | -------------------------------------------------------------------------------- /java/spring-server/src/main/k8s/jaeger.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2020 Oracle and/or its affiliates. 3 | # 4 | # Licensed under the Universal Permissive License v 1.0 as shown at 5 | # https://oss.oracle.com/licenses/upl. 6 | # 7 | apiVersion: jaegertracing.io/v1 8 | kind: Jaeger 9 | metadata: 10 | name: jaeger 11 | spec: 12 | ingress: 13 | enabled: false 14 | -------------------------------------------------------------------------------- /js/src/constants/TodoFilters.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | export const SHOW_ALL = 'show_all'; 9 | export const SHOW_COMPLETED = 'show_completed'; 10 | export const SHOW_ACTIVE = 'show_active'; 11 | -------------------------------------------------------------------------------- /java/helidon-server/src/main/microk8s/jaeger.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2020, 2021, Oracle and/or its affiliates. 3 | # 4 | # Licensed under the Universal Permissive License v 1.0 as shown at 5 | # http://oss.oracle.com/licenses/upl. 6 | # 7 | apiVersion: jaegertracing.io/v1 8 | kind: Jaeger 9 | metadata: 10 | name: jaeger 11 | spec: 12 | ingress: 13 | enabled: false -------------------------------------------------------------------------------- /java/helidon-server/src/main/web/jet/oraclejetconfig.json: -------------------------------------------------------------------------------- 1 | {"paths":{"source":{"common":"src","web":"src-web","hybrid":"src-hybrid","javascript":"js","typescript":"ts","styles":"css","themes":"themes"},"staging":{"web":"web","hybrid":"hybrid","themes":"staged-themes"}},"defaultBrowser":"chrome","sassVer":"4.13.0","defaultTheme":"redwood","defaultCssvars":"disabled","generatorVersion":"9.0.0"} 2 | -------------------------------------------------------------------------------- /java/helidon-server/src/main/web/react/src/reducers/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | import { combineReducers } from 'redux' 9 | import todos from './todos' 10 | 11 | export default combineReducers({todos}); 12 | -------------------------------------------------------------------------------- /java/spring-server/src/main/web/react/src/reducers/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | import { combineReducers } from 'redux' 9 | import todos from './todos' 10 | 11 | export default combineReducers({todos}); 12 | -------------------------------------------------------------------------------- /java/micronaut-server/src/main/web/react/src/reducers/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | import { combineReducers } from 'redux' 9 | import todos from './todos' 10 | 11 | export default combineReducers({todos}); 12 | -------------------------------------------------------------------------------- /java/helidon-server/src/main/web/react/src/constants/TodoFilters.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | export const SHOW_ALL = 'show_all'; 9 | export const SHOW_COMPLETED = 'show_completed'; 10 | export const SHOW_ACTIVE = 'show_active'; 11 | -------------------------------------------------------------------------------- /java/micronaut-server/src/main/web/react/src/constants/TodoFilters.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | export const SHOW_ALL = 'show_all'; 9 | export const SHOW_COMPLETED = 'show_completed'; 10 | export const SHOW_ACTIVE = 'show_active'; 11 | -------------------------------------------------------------------------------- /java/spring-server/src/main/web/react/src/constants/TodoFilters.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | export const SHOW_ALL = 'show_all'; 9 | export const SHOW_COMPLETED = 'show_completed'; 10 | export const SHOW_ACTIVE = 'show_active'; 11 | -------------------------------------------------------------------------------- /java/helidon-server/src/main/web/jet/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "todo-list-example", 3 | "version": "1.0.0", 4 | "description": "Coherence To Do List Example", 5 | "dependencies": { 6 | "@oracle/oraclejet": "~12.0.0" 7 | }, 8 | "devDependencies": { 9 | "@oracle/oraclejet-tooling": "~12.0.0" 10 | }, 11 | "engines": { 12 | "node": ">=0.10.0" 13 | }, 14 | "private": true 15 | } 16 | -------------------------------------------------------------------------------- /java/helidon-server/src/main/resources/application.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2024, Oracle and/or its affiliates. 3 | # 4 | # Licensed under the Universal Permissive License v 1.0 as shown at 5 | # https://oss.oracle.com/licenses/upl. 6 | # 7 | 8 | server: 9 | port: 7001 10 | tls: 11 | enabled: false 12 | 13 | coherence: 14 | grpc: 15 | server: 16 | port: 1408 17 | tracing: 18 | ratio: 0 -------------------------------------------------------------------------------- /java/helidon-server/src/main/resources/META-INF/services/io.helidon.grpc.core.MarshallerSupplier: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2024, Oracle and/or its affiliates. 3 | # 4 | # Licensed under the Universal Permissive License v 1.0 as shown at 5 | # https://oss.oracle.com/licenses/upl. 6 | # 7 | com.oracle.coherence.examples.todo.server.io.SerializerMarshaller$Supplier 8 | com.oracle.coherence.examples.todo.server.io.PofMarshaller$Supplier -------------------------------------------------------------------------------- /java/helidon-server/src/main/web/jet/src/css/app.css: -------------------------------------------------------------------------------- 1 | /* 2 | Document : override 3 | Created on : 4 | Author : 5 | Description: 6 | This is where any of your application specific styles should be included 7 | */ 8 | 9 | .sendOffScreen { 10 | position: absolute; 11 | left: -10000px; 12 | top: auto; 13 | width: 1px; 14 | height: 1px; 15 | overflow: hidden; 16 | } -------------------------------------------------------------------------------- /java/helidon-client/src/main/resources/application.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2020, 2024, Oracle and/or its affiliates. 3 | # 4 | # Licensed under the Universal Permissive License v 1.0 as shown at 5 | # https://oss.oracle.com/licenses/upl. 6 | # 7 | 8 | mp: 9 | initializer: 10 | allow: true 11 | no-warn: true 12 | 13 | grpc: 14 | client: 15 | channels: 16 | - name: "default" 17 | tls: 18 | enabled: "false" 19 | -------------------------------------------------------------------------------- /java/helidon-server/src/main/web/jet/scripts/hooks/after_app_create.js: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2015, 2020, Oracle and/or its affiliates. 3 | Licensed under The Universal Permissive License (UPL), Version 1.0 4 | as shown at https://oss.oracle.com/licenses/upl/ 5 | 6 | */ 7 | 'use strict'; 8 | 9 | module.exports = function () { 10 | return new Promise((resolve) => { 11 | console.log('Running after_app_create hook.'); 12 | resolve(); 13 | }); 14 | }; 15 | -------------------------------------------------------------------------------- /java/helidon-server/src/main/web/jet/scripts/hooks/after_app_restore.js: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2015, 2020, Oracle and/or its affiliates. 3 | Licensed under The Universal Permissive License (UPL), Version 1.0 4 | as shown at https://oss.oracle.com/licenses/upl/ 5 | 6 | */ 7 | 'use strict'; 8 | 9 | module.exports = function () { 10 | return new Promise((resolve) => { 11 | console.log('Running after_app_restore hook.'); 12 | resolve(); 13 | }); 14 | }; 15 | -------------------------------------------------------------------------------- /java/helidon-server/src/main/web/jet/scripts/hooks/after_build.js: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2015, 2020, Oracle and/or its affiliates. 3 | Licensed under The Universal Permissive License (UPL), Version 1.0 4 | as shown at https://oss.oracle.com/licenses/upl/ 5 | 6 | */ 7 | 8 | 'use strict'; 9 | 10 | module.exports = function (configObj) { 11 | return new Promise((resolve, reject) => { 12 | console.log("Running after_build hook."); 13 | resolve(configObj); 14 | }); 15 | }; 16 | -------------------------------------------------------------------------------- /java/helidon-server/src/main/web/jet/scripts/hooks/after_serve.js: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2015, 2020, Oracle and/or its affiliates. 3 | Licensed under The Universal Permissive License (UPL), Version 1.0 4 | as shown at https://oss.oracle.com/licenses/upl/ 5 | 6 | */ 7 | 8 | 'use strict'; 9 | 10 | module.exports = function (configObj) { 11 | return new Promise((resolve, reject) => { 12 | console.log("Running after_serve hook."); 13 | resolve(configObj); 14 | }); 15 | }; 16 | -------------------------------------------------------------------------------- /java/helidon-server/src/main/web/jet/scripts/hooks/after_watch.js: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2015, 2020, Oracle and/or its affiliates. 3 | Licensed under The Universal Permissive License (UPL), Version 1.0 4 | as shown at https://oss.oracle.com/licenses/upl/ 5 | 6 | */ 7 | 8 | 'use strict'; 9 | 10 | module.exports = function (configObj) { 11 | return new Promise((resolve, reject) => { 12 | console.log("Running after_watch hook."); 13 | resolve(configObj); 14 | }); 15 | }; 16 | -------------------------------------------------------------------------------- /java/helidon-server/src/main/web/jet/scripts/hooks/before_build.js: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2015, 2020, Oracle and/or its affiliates. 3 | Licensed under The Universal Permissive License (UPL), Version 1.0 4 | as shown at https://oss.oracle.com/licenses/upl/ 5 | 6 | */ 7 | 8 | 'use strict'; 9 | 10 | module.exports = function (configObj) { 11 | return new Promise((resolve, reject) => { 12 | console.log("Running before_build hook."); 13 | resolve(configObj); 14 | }); 15 | }; 16 | -------------------------------------------------------------------------------- /java/helidon-server/src/main/web/jet/scripts/hooks/before_serve.js: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2015, 2020, Oracle and/or its affiliates. 3 | Licensed under The Universal Permissive License (UPL), Version 1.0 4 | as shown at https://oss.oracle.com/licenses/upl/ 5 | 6 | */ 7 | 8 | 'use strict'; 9 | 10 | module.exports = function (configObj) { 11 | return new Promise((resolve, reject) => { 12 | console.log("Running before_serve hook."); 13 | resolve(configObj); 14 | }); 15 | }; 16 | -------------------------------------------------------------------------------- /java/helidon-server/src/main/web/jet/scripts/hooks/before_watch.js: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2015, 2020, Oracle and/or its affiliates. 3 | Licensed under The Universal Permissive License (UPL), Version 1.0 4 | as shown at https://oss.oracle.com/licenses/upl/ 5 | 6 | */ 7 | 8 | 'use strict'; 9 | 10 | module.exports = function (configObj) { 11 | return new Promise((resolve, reject) => { 12 | console.log("Running before_watch hook."); 13 | resolve(configObj); 14 | }); 15 | }; 16 | -------------------------------------------------------------------------------- /java/helidon-server/src/main/web/jet/scripts/hooks/after_app_typescript.js: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2015, 2020, Oracle and/or its affiliates. 3 | Licensed under The Universal Permissive License (UPL), Version 1.0 4 | as shown at https://oss.oracle.com/licenses/upl/ 5 | 6 | */ 7 | 'use strict'; 8 | 9 | module.exports = function (configObj) { 10 | return new Promise((resolve) => { 11 | console.log("Running after_app_typescript hook."); 12 | resolve(configObj); 13 | }); 14 | }; 15 | -------------------------------------------------------------------------------- /java/helidon-server/src/main/web/jet/scripts/hooks/before_optimize.js: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2015, 2020, Oracle and/or its affiliates. 3 | Licensed under The Universal Permissive License (UPL), Version 1.0 4 | as shown at https://oss.oracle.com/licenses/upl/ 5 | 6 | */ 7 | 8 | 'use strict'; 9 | 10 | module.exports = function (configObj) { 11 | return new Promise((resolve, reject) => { 12 | console.log("Running before_optimize hook."); 13 | resolve(configObj); 14 | }); 15 | }; 16 | -------------------------------------------------------------------------------- /java/helidon-server/src/main/web/jet/scripts/hooks/after_component_typescript.js: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2015, 2020, Oracle and/or its affiliates. 3 | Licensed under The Universal Permissive License (UPL), Version 1.0 4 | as shown at https://oss.oracle.com/licenses/upl/ 5 | 6 | */ 7 | 'use strict'; 8 | 9 | module.exports = function (configObj) { 10 | return new Promise((resolve) => { 11 | console.log("Running after_component_typescript hook."); 12 | resolve(configObj); 13 | }); 14 | }; 15 | -------------------------------------------------------------------------------- /java/helidon-server/src/main/web/jet/scripts/hooks/before_hybrid_build.js: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2015, 2020, Oracle and/or its affiliates. 3 | Licensed under The Universal Permissive License (UPL), Version 1.0 4 | as shown at https://oss.oracle.com/licenses/upl/ 5 | 6 | */ 7 | 8 | 'use strict'; 9 | 10 | module.exports = function (configObj) { 11 | return new Promise((resolve, reject) => { 12 | console.log("Running before_hybrid_build hook."); 13 | resolve(configObj); 14 | }); 15 | }; 16 | -------------------------------------------------------------------------------- /java/helidon-server/src/main/web/jet/scripts/hooks/before_release_build.js: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2015, 2020, Oracle and/or its affiliates. 3 | Licensed under The Universal Permissive License (UPL), Version 1.0 4 | as shown at https://oss.oracle.com/licenses/upl/ 5 | 6 | */ 7 | 8 | 'use strict'; 9 | 10 | module.exports = function (configObj) { 11 | return new Promise((resolve, reject) => { 12 | console.log("Running before_release_build hook."); 13 | resolve(configObj); 14 | }); 15 | }; 16 | -------------------------------------------------------------------------------- /java/helidon-server/src/main/web/jet/scripts/hooks/after_component_build.js: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2015, 2020, Oracle and/or its affiliates. 3 | Licensed under The Universal Permissive License (UPL), Version 1.0 4 | as shown at https://oss.oracle.com/licenses/upl/ 5 | 6 | */ 7 | 8 | 'use strict'; 9 | 10 | module.exports = function (configObj) { 11 | return new Promise((resolve, reject) => { 12 | console.log("Running after_component_build hook."); 13 | resolve(configObj); 14 | }); 15 | }; 16 | -------------------------------------------------------------------------------- /java/helidon-server/src/main/web/jet/scripts/hooks/before_component_optimize.js: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2015, 2020, Oracle and/or its affiliates. 3 | Licensed under The Universal Permissive License (UPL), Version 1.0 4 | as shown at https://oss.oracle.com/licenses/upl/ 5 | 6 | */ 7 | 8 | 'use strict'; 9 | 10 | module.exports = function (configObj) { 11 | return new Promise((resolve, reject) => { 12 | console.log("Running before_component_optimize hook."); 13 | resolve(configObj); 14 | }); 15 | }; 16 | -------------------------------------------------------------------------------- /py/react-app/index.html: -------------------------------------------------------------------------------- 1 | Coherence To Do Example Application
-------------------------------------------------------------------------------- /java/coherence-client/src/main/resources/com/oracle/coherence/examples/todo/client/ToDoApplication.css: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020 Oracle and/or its affiliates. 3 | 4 | Licensed under the Universal Permissive License v 1.0 as shown at 5 | https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | .label { 9 | -fx-font-family: Arial; 10 | -fx-font-size: 20px; 11 | } 12 | 13 | .textField { 14 | -fx-font-family: Arial; 15 | -fx-font-size: 15px; 16 | -fx-prompt-text-fill: derive(-fx-control-inner-background,-30%); 17 | } 18 | 19 | -------------------------------------------------------------------------------- /java/helidon-client/src/main/resources/com/oracle/coherence/examples/todo/client/ToDoApplication.css: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2020 Oracle and/or its affiliates. 3 | 4 | Licensed under the Universal Permissive License v 1.0 as shown at 5 | https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | .label { 9 | -fx-font-family: Arial; 10 | -fx-font-size: 20px; 11 | } 12 | 13 | .textField { 14 | -fx-font-family: Arial; 15 | -fx-font-size: 15px; 16 | -fx-prompt-text-fill: derive(-fx-control-inner-background,-30%); 17 | } 18 | 19 | -------------------------------------------------------------------------------- /js/src/App.test.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | import React from 'react'; 9 | import { render } from '@testing-library/react'; 10 | import App from './App'; 11 | 12 | test('renders learn react link', () => { 13 | const { getByText } = render(); 14 | const linkElement = getByText(/learn react/i); 15 | expect(linkElement).toBeInTheDocument(); 16 | }); 17 | -------------------------------------------------------------------------------- /js/src/constants/ActionTypes.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | export const LOGIN = 'LOGIN'; 9 | export const INIT_TODOS = 'INIT_TODOS'; 10 | export const ADD_TODO = 'ADD_TODO'; 11 | export const DELETE_TODO = 'DELETE_TODO'; 12 | export const UPDATE_TODO = 'UPDATE_TODO'; 13 | export const COMPLETE_TODO = 'TOGGLE_TODO'; 14 | export const CLEAR_COMPLETED = 'CLEAR_COMPLETED'; 15 | -------------------------------------------------------------------------------- /java/helidon-server/src/main/web/jet/scripts/hooks/after_component_create.js: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2015, 2020, Oracle and/or its affiliates. 3 | Licensed under The Universal Permissive License (UPL), Version 1.0 4 | as shown at https://oss.oracle.com/licenses/upl/ 5 | 6 | */ 7 | 'use strict'; 8 | 9 | module.exports = function (configObj) { 10 | return new Promise((resolve) => { 11 | console.log('Running after_component_create hook.'); 12 | // const componentPath = configObj.componentPath; 13 | resolve(configObj); 14 | }); 15 | }; 16 | -------------------------------------------------------------------------------- /java/helidon-server/src/main/web/jet/scripts/hooks/before_app_typescript.js: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2015, 2020, Oracle and/or its affiliates. 3 | Licensed under The Universal Permissive License (UPL), Version 1.0 4 | as shown at https://oss.oracle.com/licenses/upl/ 5 | 6 | */ 7 | 'use strict'; 8 | 9 | module.exports = function (configObj) { 10 | return new Promise((resolve) => { 11 | console.log("Running before_app_typescript hook."); 12 | //const { tsconfigJson } = configObj.typescript; 13 | resolve(configObj); 14 | }); 15 | }; 16 | -------------------------------------------------------------------------------- /java/helidon-server/src/main/web/jet/scripts/hooks/before_component_typescript.js: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2015, 2020, Oracle and/or its affiliates. 3 | Licensed under The Universal Permissive License (UPL), Version 1.0 4 | as shown at https://oss.oracle.com/licenses/upl/ 5 | 6 | */ 7 | 'use strict'; 8 | 9 | module.exports = function (configObj) { 10 | return new Promise((resolve) => { 11 | console.log("Running before_component_typescript hook."); 12 | //const { tsconfigJson } = configObj.typescript; 13 | resolve(configObj); 14 | }); 15 | }; 16 | -------------------------------------------------------------------------------- /java/helidon-server/src/main/resources/logging.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2020, 2024, Oracle and/or its affiliates. 3 | # 4 | # Licensed under the Universal Permissive License v 1.0 as shown at 5 | # https://oss.oracle.com/licenses/upl. 6 | # 7 | 8 | handlers=io.helidon.logging.jul.HelidonConsoleHandler 9 | 10 | # Global default logging level. Can be overriden by specific handlers and loggers 11 | .level=CONFIG 12 | 13 | # Formatter configuration 14 | java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$s %3$s !thread!: %5$s%6$s%n 15 | -------------------------------------------------------------------------------- /java/helidon-server/src/main/web/react/src/App.test.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | import React from 'react'; 9 | import { render } from '@testing-library/react'; 10 | import App from './App'; 11 | 12 | test('renders learn react link', () => { 13 | const { getByText } = render(); 14 | const linkElement = getByText(/learn react/i); 15 | expect(linkElement).toBeInTheDocument(); 16 | }); 17 | -------------------------------------------------------------------------------- /java/spring-server/src/main/web/react/src/App.test.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | import React from 'react'; 9 | import { render } from '@testing-library/react'; 10 | import App from './App'; 11 | 12 | test('renders learn react link', () => { 13 | const { getByText } = render(); 14 | const linkElement = getByText(/learn react/i); 15 | expect(linkElement).toBeInTheDocument(); 16 | }); 17 | -------------------------------------------------------------------------------- /java/micronaut-server/src/main/web/react/src/App.test.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | import React from 'react'; 9 | import { render } from '@testing-library/react'; 10 | import App from './App'; 11 | 12 | test('renders learn react link', () => { 13 | const { getByText } = render(); 14 | const linkElement = getByText(/learn react/i); 15 | expect(linkElement).toBeInTheDocument(); 16 | }); 17 | -------------------------------------------------------------------------------- /java/spring-server/src/main/web/react/src/constants/ActionTypes.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | export const LOGIN = 'LOGIN'; 9 | export const INIT_TODOS = 'INIT_TODOS'; 10 | export const ADD_TODO = 'ADD_TODO'; 11 | export const DELETE_TODO = 'DELETE_TODO'; 12 | export const UPDATE_TODO = 'UPDATE_TODO'; 13 | export const COMPLETE_TODO = 'TOGGLE_TODO'; 14 | export const CLEAR_COMPLETED = 'CLEAR_COMPLETED'; 15 | -------------------------------------------------------------------------------- /java/helidon-server/src/main/web/react/src/constants/ActionTypes.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | export const LOGIN = 'LOGIN'; 9 | export const INIT_TODOS = 'INIT_TODOS'; 10 | export const ADD_TODO = 'ADD_TODO'; 11 | export const DELETE_TODO = 'DELETE_TODO'; 12 | export const UPDATE_TODO = 'UPDATE_TODO'; 13 | export const COMPLETE_TODO = 'TOGGLE_TODO'; 14 | export const CLEAR_COMPLETED = 'CLEAR_COMPLETED'; 15 | -------------------------------------------------------------------------------- /java/micronaut-server/src/main/web/react/src/constants/ActionTypes.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | export const LOGIN = 'LOGIN'; 9 | export const INIT_TODOS = 'INIT_TODOS'; 10 | export const ADD_TODO = 'ADD_TODO'; 11 | export const DELETE_TODO = 'DELETE_TODO'; 12 | export const UPDATE_TODO = 'UPDATE_TODO'; 13 | export const COMPLETE_TODO = 'TOGGLE_TODO'; 14 | export const CLEAR_COMPLETED = 'CLEAR_COMPLETED'; 15 | -------------------------------------------------------------------------------- /java/coherence-client/src/main/resources/META-INF/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 12 | -------------------------------------------------------------------------------- /js/src/components/Header.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | import React, { Component } from 'react' 9 | 10 | class Header extends Component { 11 | render() { 12 | const title = "Tasks"; 13 | const image = "todos.png"; 14 | 15 | return ( 16 |
17 |

{title}

18 |
19 | ) 20 | } 21 | } 22 | 23 | export default Header; 24 | -------------------------------------------------------------------------------- /java/helidon-client/src/main/resources/META-INF/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 14 | -------------------------------------------------------------------------------- /java/helidon-server/src/main/web/react/src/components/Header.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | import React, { Component } from 'react' 9 | 10 | class Header extends Component { 11 | render() { 12 | const title = "Tasks"; 13 | const image = "todos.png"; 14 | 15 | return ( 16 |
17 |

{title}

18 |
19 | ) 20 | } 21 | } 22 | 23 | export default Header; 24 | -------------------------------------------------------------------------------- /java/micronaut-server/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | true 5 | 7 | 8 | %cyan(%d{HH:mm:ss.SSS}) %gray([%thread]) %highlight(%-5level) %magenta(%logger{36}) - %msg%n 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /java/spring-server/src/main/web/react/src/components/Header.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | import React, { Component } from 'react' 9 | 10 | class Header extends Component { 11 | render() { 12 | const title = "Tasks"; 13 | const image = "todos.png"; 14 | 15 | return ( 16 |
17 |

{title}

18 |
19 | ) 20 | } 21 | } 22 | 23 | export default Header; 24 | -------------------------------------------------------------------------------- /java/micronaut-server/src/main/web/react/src/components/Header.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | import React, { Component } from 'react' 9 | 10 | class Header extends Component { 11 | render() { 12 | const title = "Tasks"; 13 | const image = "todos.png"; 14 | 15 | return ( 16 |
17 |

{title}

18 |
19 | ) 20 | } 21 | } 22 | 23 | export default Header; 24 | -------------------------------------------------------------------------------- /java/micronaut-server/src/main/java/com/oracle/coherence/examples/todo/server/Application.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | package com.oracle.coherence.examples.todo.server; 9 | 10 | import io.micronaut.runtime.Micronaut; 11 | 12 | /** 13 | * {@code Micronaut} entry point. 14 | */ 15 | public class Application 16 | { 17 | public static void main(String[] args) 18 | { 19 | Micronaut.run(Application.class, args); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /js/src/index.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | body { 9 | margin: 0; 10 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 11 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 12 | sans-serif; 13 | -webkit-font-smoothing: antialiased; 14 | -moz-osx-font-smoothing: grayscale; 15 | } 16 | 17 | code { 18 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 19 | monospace; 20 | } 21 | -------------------------------------------------------------------------------- /java/helidon-server/src/main/resources/META-INF/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 14 | -------------------------------------------------------------------------------- /java/helidon-server/src/main/web/react/src/index.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | body { 9 | margin: 0; 10 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 11 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 12 | sans-serif; 13 | -webkit-font-smoothing: antialiased; 14 | -moz-osx-font-smoothing: grayscale; 15 | } 16 | 17 | code { 18 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 19 | monospace; 20 | } 21 | -------------------------------------------------------------------------------- /java/micronaut-server/src/main/web/react/src/index.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | body { 9 | margin: 0; 10 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 11 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 12 | sans-serif; 13 | -webkit-font-smoothing: antialiased; 14 | -moz-osx-font-smoothing: grayscale; 15 | } 16 | 17 | code { 18 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 19 | monospace; 20 | } 21 | -------------------------------------------------------------------------------- /java/spring-server/src/main/web/react/src/index.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | body { 9 | margin: 0; 10 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 11 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 12 | sans-serif; 13 | -webkit-font-smoothing: antialiased; 14 | -moz-osx-font-smoothing: grayscale; 15 | } 16 | 17 | code { 18 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 19 | monospace; 20 | } 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .classpath 2 | .DS_Store 3 | .gradle 4 | .idea/ 5 | .project 6 | .settings/ 7 | 8 | *.iml 9 | *.swp 10 | 11 | babel_cache/ 12 | build/ 13 | gradle/ 14 | node_modules/ 15 | target/ 16 | 17 | java/server/src/main/resources/web/ 18 | java/server/src/main/web/jet/staged-themes/ 19 | java/server/src/main/web/jet/web/ 20 | java/server/src/main/web/react/build 21 | 22 | java/micronaut-server/src/main/resources/web/ 23 | java/micronaut-server/src/main/web/react/build 24 | java/spring-server/src/main/web/react/build/ 25 | java/spring-server/src/main/web/react/node/ 26 | java/spring-server/src/main/web/react/npm-debug.log 27 | 28 | dependency-reduced-pom.xml 29 | package-lock.json 30 | yarn.lock 31 | .java-version 32 | .factorypath 33 | -------------------------------------------------------------------------------- /java/helidon-server/src/main/resources/META-INF/microprofile-config.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2020, 2024, Oracle and/or its affiliates. 3 | # 4 | # Licensed under the Universal Permissive License v 1.0 as shown at 5 | # https://oss.oracle.com/licenses/upl. 6 | # 7 | 8 | service.name=Tasks 9 | 10 | server.static.classpath.location=/web 11 | server.static.classpath.welcome=index.html 12 | 13 | telemetry.span.name-includes-method = true 14 | 15 | coherence.serializer=pof 16 | coherence.grpc.enabled=false 17 | coherence.proxy.enabled=false 18 | coherence.topic.enabled=false 19 | coherence.tracing.ratio=0 20 | 21 | # MP GraphQL 22 | graphql.cors=Access-Control-Allow-Origin 23 | mp.graphql.exceptionsWhiteList=java.lang.NullPointerException,jakarta.ws.rs.NotFoundException 24 | -------------------------------------------------------------------------------- /js/public/index.html: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 16 | Coherence To Do Example Application 17 | 18 | 19 | 20 |
21 | 22 | 23 | -------------------------------------------------------------------------------- /java/spring-server/src/main/web/react/public/index.html: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 16 | Coherence To Do Example Application 17 | 18 | 19 | 20 |
21 | 22 | 23 | -------------------------------------------------------------------------------- /java/helidon-server/src/main/web/react/public/index.html: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 16 | Coherence To Do Example Application 17 | 18 | 19 | 20 |
21 | 22 | 23 | -------------------------------------------------------------------------------- /java/micronaut-server/src/main/web/react/public/index.html: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 16 | Coherence To Do Example Application 17 | 18 | 19 | 20 |
21 | 22 | 23 | -------------------------------------------------------------------------------- /js/src/components/TodoInput.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | import React, { Component } from 'react' 9 | import PropTypes from 'prop-types' 10 | import TodoTextInput from './TodoTextInput' 11 | 12 | class TodoInput extends Component { 13 | static propTypes = { 14 | addTodo: PropTypes.func.isRequired 15 | }; 16 | 17 | handleSave = (text) => { 18 | if (text.length !== 0) { 19 | this.props.addTodo(text); 20 | } 21 | }; 22 | 23 | render() { 24 | return ( 25 | 28 | ) 29 | } 30 | } 31 | 32 | export default TodoInput; 33 | -------------------------------------------------------------------------------- /js/src/App.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | import React from 'react'; 9 | import logo from './logo.svg'; 10 | import './App.css'; 11 | 12 | function App() { 13 | return ( 14 |
15 |
16 | logo 17 |

18 | Edit src/App.js and save to reload. 19 |

20 | 26 | Learn React 27 | 28 |
29 |
30 | ); 31 | } 32 | 33 | export default App; 34 | -------------------------------------------------------------------------------- /java/helidon-server/src/main/web/react/src/components/TodoInput.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | import React, { Component } from 'react' 9 | import PropTypes from 'prop-types' 10 | import TodoTextInput from './TodoTextInput' 11 | 12 | class TodoInput extends Component { 13 | static propTypes = { 14 | addTodo: PropTypes.func.isRequired 15 | }; 16 | 17 | handleSave = (text) => { 18 | if (text.length !== 0) { 19 | this.props.addTodo(text); 20 | } 21 | }; 22 | 23 | render() { 24 | return ( 25 | 28 | ) 29 | } 30 | } 31 | 32 | export default TodoInput; 33 | -------------------------------------------------------------------------------- /java/micronaut-server/src/main/web/react/src/components/TodoInput.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | import React, { Component } from 'react' 9 | import PropTypes from 'prop-types' 10 | import TodoTextInput from './TodoTextInput' 11 | 12 | class TodoInput extends Component { 13 | static propTypes = { 14 | addTodo: PropTypes.func.isRequired 15 | }; 16 | 17 | handleSave = (text) => { 18 | if (text.length !== 0) { 19 | this.props.addTodo(text); 20 | } 21 | }; 22 | 23 | render() { 24 | return ( 25 | 28 | ) 29 | } 30 | } 31 | 32 | export default TodoInput; 33 | -------------------------------------------------------------------------------- /java/spring-server/src/main/web/react/src/components/TodoInput.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | import React, { Component } from 'react' 9 | import PropTypes from 'prop-types' 10 | import TodoTextInput from './TodoTextInput' 11 | 12 | class TodoInput extends Component { 13 | static propTypes = { 14 | addTodo: PropTypes.func.isRequired 15 | }; 16 | 17 | handleSave = (text) => { 18 | if (text.length !== 0) { 19 | this.props.addTodo(text); 20 | } 21 | }; 22 | 23 | render() { 24 | return ( 25 | 28 | ) 29 | } 30 | } 31 | 32 | export default TodoInput; 33 | -------------------------------------------------------------------------------- /java/helidon-server/src/main/web/react/src/App.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | import React from 'react'; 9 | import logo from './logo.svg'; 10 | import './App.css'; 11 | 12 | function App() { 13 | return ( 14 |
15 |
16 | logo 17 |

18 | Edit src/App.js and save to reload. 19 |

20 | 26 | Learn React 27 | 28 |
29 |
30 | ); 31 | } 32 | 33 | export default App; 34 | -------------------------------------------------------------------------------- /java/spring-server/src/main/web/react/src/App.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | import React from 'react'; 9 | import logo from './logo.svg'; 10 | import './App.css'; 11 | 12 | function App() { 13 | return ( 14 |
15 |
16 | logo 17 |

18 | Edit src/App.js and save to reload. 19 |

20 | 26 | Learn React 27 | 28 |
29 |
30 | ); 31 | } 32 | 33 | export default App; 34 | -------------------------------------------------------------------------------- /java/coherence-client/src/main/java/com/oracle/coherence/examples/todo/client/TaskEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | package com.oracle.coherence.examples.todo.client; 9 | 10 | /** 11 | * Task event. 12 | * 13 | * @author Aleks Seovic 2020.07.28 14 | */ 15 | public class TaskEvent 16 | { 17 | private final Task oldValue; 18 | private final Task newValue; 19 | 20 | public TaskEvent(Task oldValue, Task newValue) 21 | { 22 | this.oldValue = oldValue; 23 | this.newValue = newValue; 24 | } 25 | 26 | public Task getOldValue() 27 | { 28 | return oldValue; 29 | } 30 | 31 | public Task getNewValue() 32 | { 33 | return newValue; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /java/micronaut-server/src/main/web/react/src/App.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | import React from 'react'; 9 | import logo from './logo.svg'; 10 | import './App.css'; 11 | 12 | function App() { 13 | return ( 14 |
15 |
16 | logo 17 |

18 | Edit src/App.js and save to reload. 19 |

20 | 26 | Learn React 27 | 28 |
29 |
30 | ); 31 | } 32 | 33 | export default App; 34 | -------------------------------------------------------------------------------- /js/README.md: -------------------------------------------------------------------------------- 1 | ## Coherence To Do List Example Using `coherence-js-client` 2 | 3 | ### Overview 4 | 5 | ### Prerequisites 6 | 7 | In order to build and run the examples, you must have the following installed: 8 | * Node 18.15.x or later 9 | * NPM 9.x or later 10 | 11 | ### Build Instructions 12 | 13 | 1. Initialize `npm` 14 | ```bash 15 | npm install -s 16 | ``` 17 | 18 | ### Running the Example 19 | 20 | 1. Start the server. See the java [README](../java/README.md) for details. 21 | 22 | 2. Start the Express server on port 7002: 23 | ```bash 24 | npm run start 25 | ``` 26 | or, to start the Express server on a different port: 27 | ```bash 28 | PORT= npm run start 29 | ``` 30 | 31 | 4. Access the Web UI via [http://localhost:7002](http://localhost:7002) (change 7002 to the specified custom port) 32 | 33 | ![To Do List - React Client](../assets/react-client.png) 34 | -------------------------------------------------------------------------------- /.github/workflows/trivy-scan.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Oracle Corporation and/or its affiliates. 2 | # Licensed under the Universal Permissive License v 1.0 as shown at 3 | # https://oss.oracle.com/licenses/upl. 4 | 5 | # --------------------------------------------------------------------------- 6 | # Coherence ToDo List Example GitHub Actions Scheduled Trivy Scan 7 | # --------------------------------------------------------------------------- 8 | name: Scheduled Trivy Scan 9 | 10 | on: 11 | workflow_dispatch: 12 | schedule: 13 | # Every day at midnight 14 | - cron: '0 0 * * *' 15 | 16 | jobs: 17 | trivy-scan: 18 | runs-on: ubuntu-latest 19 | 20 | steps: 21 | - name: Checkout code 22 | uses: actions/checkout@v4 23 | 24 | - name: Run Trivy vulnerability scanner to scan repo 25 | uses: aquasecurity/trivy-action@0.32.0 26 | with: 27 | scan-type: 'fs' 28 | exit-code: 1 29 | -------------------------------------------------------------------------------- /java/micronaut-server/src/main/java/com/oracle/coherence/examples/todo/server/TaskRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | package com.oracle.coherence.examples.todo.server; 8 | 9 | import io.micronaut.coherence.data.AbstractCoherenceRepository; 10 | import io.micronaut.coherence.data.annotation.CoherenceRepository; 11 | import java.util.Collection; 12 | 13 | /** 14 | * A {@code Coherence}-base {@code Micronaut Data} repository for working with {@link Task tasks}. 15 | */ 16 | @CoherenceRepository("tasks") 17 | public abstract class TaskRepository 18 | extends AbstractCoherenceRepository 19 | { 20 | /** 21 | * Delete all {@link Task}s that have been completed. 22 | */ 23 | public abstract void deleteByCompletedTrue(); 24 | } 25 | -------------------------------------------------------------------------------- /js/src/App.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | .App { 9 | text-align: center; 10 | } 11 | 12 | .App-logo { 13 | height: 40vmin; 14 | pointer-events: none; 15 | } 16 | 17 | @media (prefers-reduced-motion: no-preference) { 18 | .App-logo { 19 | animation: App-logo-spin infinite 20s linear; 20 | } 21 | } 22 | 23 | .App-header { 24 | background-color: #282c34; 25 | min-height: 100vh; 26 | display: flex; 27 | flex-direction: column; 28 | align-items: center; 29 | justify-content: center; 30 | font-size: calc(10px + 2vmin); 31 | color: white; 32 | } 33 | 34 | .App-link { 35 | color: #61dafb; 36 | } 37 | 38 | @keyframes App-logo-spin { 39 | from { 40 | transform: rotate(0deg); 41 | } 42 | to { 43 | transform: rotate(360deg); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /java/helidon-server/src/main/web/react/src/App.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | .App { 9 | text-align: center; 10 | } 11 | 12 | .App-logo { 13 | height: 40vmin; 14 | pointer-events: none; 15 | } 16 | 17 | @media (prefers-reduced-motion: no-preference) { 18 | .App-logo { 19 | animation: App-logo-spin infinite 20s linear; 20 | } 21 | } 22 | 23 | .App-header { 24 | background-color: #282c34; 25 | min-height: 100vh; 26 | display: flex; 27 | flex-direction: column; 28 | align-items: center; 29 | justify-content: center; 30 | font-size: calc(10px + 2vmin); 31 | color: white; 32 | } 33 | 34 | .App-link { 35 | color: #61dafb; 36 | } 37 | 38 | @keyframes App-logo-spin { 39 | from { 40 | transform: rotate(0deg); 41 | } 42 | to { 43 | transform: rotate(360deg); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /java/spring-server/src/main/web/react/src/App.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | .App { 9 | text-align: center; 10 | } 11 | 12 | .App-logo { 13 | height: 40vmin; 14 | pointer-events: none; 15 | } 16 | 17 | @media (prefers-reduced-motion: no-preference) { 18 | .App-logo { 19 | animation: App-logo-spin infinite 20s linear; 20 | } 21 | } 22 | 23 | .App-header { 24 | background-color: #282c34; 25 | min-height: 100vh; 26 | display: flex; 27 | flex-direction: column; 28 | align-items: center; 29 | justify-content: center; 30 | font-size: calc(10px + 2vmin); 31 | color: white; 32 | } 33 | 34 | .App-link { 35 | color: #61dafb; 36 | } 37 | 38 | @keyframes App-logo-spin { 39 | from { 40 | transform: rotate(0deg); 41 | } 42 | to { 43 | transform: rotate(360deg); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /java/micronaut-server/src/main/web/react/src/App.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | .App { 9 | text-align: center; 10 | } 11 | 12 | .App-logo { 13 | height: 40vmin; 14 | pointer-events: none; 15 | } 16 | 17 | @media (prefers-reduced-motion: no-preference) { 18 | .App-logo { 19 | animation: App-logo-spin infinite 20s linear; 20 | } 21 | } 22 | 23 | .App-header { 24 | background-color: #282c34; 25 | min-height: 100vh; 26 | display: flex; 27 | flex-direction: column; 28 | align-items: center; 29 | justify-content: center; 30 | font-size: calc(10px + 2vmin); 31 | color: white; 32 | } 33 | 34 | .App-link { 35 | color: #61dafb; 36 | } 37 | 38 | @keyframes App-logo-spin { 39 | from { 40 | transform: rotate(0deg); 41 | } 42 | to { 43 | transform: rotate(360deg); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /java/micronaut-server/src/main/resources/schema.graphqls: -------------------------------------------------------------------------------- 1 | type Mutation { 2 | "Create a task with the given description" 3 | createTask(description: String): Task 4 | "Remove all completed tasks and return the tasks left" 5 | deleteCompletedTasks: [Task] 6 | "Delete a task and return the deleted task details" 7 | deleteTask(id: String): Task 8 | "Update a task" 9 | updateTask(completed: Boolean, description: String, id: String): Task 10 | } 11 | 12 | type Query { 13 | "Find a given task using the task id" 14 | findTask(id: String): Task 15 | "Query tasks and optionally specify only completed" 16 | tasks(completed: Boolean): [Task] 17 | } 18 | 19 | type Task { 20 | completed: Boolean 21 | createdAt: BigInteger! 22 | createdAtDate: DateTime 23 | description: String 24 | id: String 25 | } 26 | 27 | "Custom: Built-in java.math.BigInteger" 28 | scalar BigInteger 29 | 30 | "Custom: An RFC-3339 compliant DateTime Scalar" 31 | scalar DateTime -------------------------------------------------------------------------------- /java/spring-server/src/main/java/com/oracle/coherence/examples/todo/server/config/GlobalControllerExceptionHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | package com.oracle.coherence.examples.todo.server.config; 8 | 9 | import com.oracle.coherence.examples.todo.server.service.TaskNotFoundException; 10 | import org.springframework.http.HttpStatus; 11 | import org.springframework.web.bind.annotation.ControllerAdvice; 12 | import org.springframework.web.bind.annotation.ExceptionHandler; 13 | import org.springframework.web.bind.annotation.ResponseStatus; 14 | 15 | /** 16 | * @author Gunnar Hillert 17 | */ 18 | @ControllerAdvice 19 | public class GlobalControllerExceptionHandler { 20 | 21 | @ResponseStatus(HttpStatus.NOT_FOUND) 22 | @ExceptionHandler(TaskNotFoundException.class) 23 | public void handleTaskNotFoundException() { 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/spring-server/src/main/java/com/oracle/coherence/examples/todo/server/TodoListSpringServerApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | package com.oracle.coherence.examples.todo.server; 8 | 9 | import com.tangosol.coherence.config.Config; 10 | import org.springframework.boot.SpringApplication; 11 | import org.springframework.boot.autoconfigure.SpringBootApplication; 12 | 13 | /** 14 | * Entry-point to the To Do Application. 15 | * @author Gunnar Hillert 16 | */ 17 | @SpringBootApplication 18 | public class TodoListSpringServerApplication 19 | { 20 | public static void main(String[] args) 21 | { 22 | SpringApplication.run(TodoListSpringServerApplication.class, args); 23 | System.out.println("coherence.tracing.ratio=" + Config.getProperty("coherence.tracing.ratio", "undefined")); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/spring-server/src/main/java/com/oracle/coherence/examples/todo/server/service/TaskService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | package com.oracle.coherence.examples.todo.server.service; 8 | 9 | import com.oracle.coherence.examples.todo.server.model.Task; 10 | 11 | import java.util.Collection; 12 | 13 | /** 14 | * Task service that delegates to the underlying 15 | * {@link com.oracle.coherence.examples.todo.server.repository.TaskRepository}. 16 | * @author Gunnar Hillert 17 | */ 18 | public interface TaskService { 19 | Collection findAll(boolean completed); 20 | 21 | Task find(String id); 22 | 23 | void save(Task task); 24 | 25 | void removeById(String id); 26 | 27 | void deleteCompletedTasks(); 28 | 29 | Collection deleteCompletedTasksAndReturnRemainingTasks(); 30 | 31 | Task update(String id, Task task); 32 | } 33 | -------------------------------------------------------------------------------- /java/micronaut-server/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2024, Oracle and/or its affiliates. 3 | # 4 | # Licensed under the Universal Permissive License v 1.0 as shown at 5 | # https://oss.oracle.com/licenses/upl. 6 | # 7 | 8 | micronaut: 9 | application: 10 | name: todo-list-micronaut-server 11 | server: 12 | port: 7001 13 | router: 14 | static-resources: 15 | default: 16 | enabled: true 17 | mapping: "/**" 18 | paths: "classpath:web" 19 | 20 | coherence: 21 | cluster: task-cluster 22 | ttl: 0 23 | wka: localhost 24 | serializer: pof 25 | distributed: 26 | localstorage: true 27 | grpc: 28 | server: 29 | port: 1408 30 | data: 31 | tasks: 32 | tracing: 33 | ratio: 0 34 | 35 | graphql: 36 | enabled: true 37 | path: /graphql 38 | graphiql.enabled: true 39 | 40 | otel: 41 | traces: 42 | exporter: otlp 43 | exporter: 44 | otlp: 45 | protocol: http/protobuf 46 | endpoint: http://localhost:4317 -------------------------------------------------------------------------------- /java/spring-server/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2024, Oracle and/or its affiliates. 3 | # 4 | # Licensed under the Universal Permissive License v 1.0 as shown at 5 | # https://oss.oracle.com/licenses/upl. 6 | # 7 | 8 | debug: false 9 | 10 | server: 11 | port: 7001 12 | 13 | spring: 14 | application: 15 | name: todo-list-spring-server 16 | graphql: 17 | cors: 18 | allowed-origins: "*" 19 | 20 | coherence: 21 | serializer: pof 22 | tracing: 23 | ratio: 0 24 | 25 | logging: 26 | level: 27 | root: warn 28 | Coherence: info 29 | com.oracle.coherence.examples.todo.server: info 30 | com.oracle.coherence.spring: info 31 | org.springframework: warn 32 | org.springframework.boot: info 33 | org.springframework.web: warn 34 | org.springframework.boot.autoconfigure.logging: warn 35 | 36 | otel: 37 | logs: 38 | exporter: none 39 | metrics: 40 | exporter: none 41 | java: 42 | global-autoconfigure: 43 | enabled: true 44 | 45 | -------------------------------------------------------------------------------- /java/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 11 | 4.0.0 12 | 13 | com.oracle.coherence.examples 14 | todo-list 15 | 25.03.2 16 | pom 17 | 18 | 19 | test-common 20 | coherence-server 21 | coherence-client 22 | helidon-client 23 | helidon-server 24 | micronaut-server 25 | spring-server 26 | 27 | 28 | -------------------------------------------------------------------------------- /java/spring-server/src/main/java/com/oracle/coherence/examples/todo/server/repository/SpringDataTaskRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | package com.oracle.coherence.examples.todo.server.repository; 8 | 9 | import com.oracle.coherence.examples.todo.server.model.Task; 10 | import com.oracle.coherence.spring.data.config.CoherenceMap; 11 | import com.oracle.coherence.spring.data.repository.CoherenceRepository; 12 | 13 | /** 14 | * A {@code Coherence}-based repository for working with {@link Task tasks}. Uses 15 | * Spring Data support which is provided by Coherence Spring. For an implementation 16 | * that uses the native Coherence repository support please see: {@link TaskRepository}. 17 | * 18 | * @author Gunnar Hillert 19 | * @see TaskRepository 20 | */ 21 | @CoherenceMap("tasks") 22 | public interface SpringDataTaskRepository extends CoherenceRepository { 23 | } 24 | -------------------------------------------------------------------------------- /go/go.mod: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2023, 2024 Oracle and/or its affiliates. 3 | // 4 | // Licensed under the Universal Permissive License v 1.0 as shown at 5 | // https://oss.oracle.com/licenses/upl. 6 | // 7 | module go-todo-list 8 | 9 | go 1.23.0 10 | 11 | toolchain go1.24.1 12 | 13 | require ( 14 | github.com/google/uuid v1.6.0 15 | github.com/onsi/gomega v1.18.1 16 | github.com/oracle/coherence-go-client/v2 v2.3.1 17 | ) 18 | 19 | require ( 20 | github.com/golang/protobuf v1.5.4 // indirect 21 | github.com/kr/pretty v0.1.0 // indirect 22 | github.com/kr/text v0.2.0 // indirect 23 | github.com/onsi/ginkgo/v2 v2.1.1 // indirect 24 | golang.org/x/net v0.41.0 // indirect 25 | golang.org/x/sys v0.33.0 // indirect 26 | golang.org/x/text v0.26.0 // indirect 27 | google.golang.org/genproto/googleapis/rpc v0.0.0-20250528174236-200df99c418a // indirect 28 | google.golang.org/grpc v1.73.0 // indirect 29 | google.golang.org/protobuf v1.36.6 // indirect 30 | gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect 31 | gopkg.in/yaml.v2 v2.4.0 // indirect 32 | ) 33 | -------------------------------------------------------------------------------- /java/spring-server/src/test/java/com/oracle/coherence/examples/todo/server/TodoListTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | package com.oracle.coherence.examples.todo.server; 8 | 9 | import com.oracle.coherence.examples.todo.test.common.BaseTodoListTests; 10 | 11 | import org.springframework.boot.test.context.SpringBootTest; 12 | 13 | import org.springframework.boot.test.web.server.LocalServerPort; 14 | 15 | @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) 16 | public class TodoListTests 17 | extends BaseTodoListTests 18 | { 19 | 20 | // ----- helper methods ------------------------------------------------- 21 | 22 | @Override 23 | protected String getUrl() 24 | { 25 | return "http://localhost:" + port; 26 | } 27 | 28 | // ----- data members --------------------------------------------------- 29 | 30 | @LocalServerPort 31 | protected int port; 32 | } 33 | -------------------------------------------------------------------------------- /java/spring-server/src/main/resources/graphql/schema.graphqls: -------------------------------------------------------------------------------- 1 | "Custom: Built-in java.math.BigInteger via Scalars.GraphQLBigInteger" 2 | scalar BigInteger 3 | 4 | "Custom: An RFC-3339 compliant DateTime Scalar provided by graphql-datetime-spring-boot-starter." 5 | scalar LocalDateTime 6 | 7 | type Mutation { 8 | "Create a task with the given description" 9 | createTask(description: String): Task 10 | "Remove all completed tasks and return the tasks left" 11 | deleteCompletedTasks: [Task] 12 | "Delete a task and return the deleted task details" 13 | deleteTask(id: String): Task 14 | "Update a task" 15 | updateTask(completed: Boolean, description: String, id: String): Task 16 | } 17 | 18 | type Query { 19 | "Find a given task using the task id" 20 | findTask(id: String): Task 21 | "Query tasks and optionally specify only completed" 22 | tasks(completed: Boolean): [Task] 23 | hello: String 24 | } 25 | 26 | type Task { 27 | completed: Boolean 28 | createdAt: BigInteger! 29 | createdAtDate: LocalDateTime 30 | description: String 31 | id: String 32 | } 33 | 34 | -------------------------------------------------------------------------------- /java/helidon-server/src/main/microk8s/app.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2020, 2022, Oracle and/or its affiliates. 3 | # 4 | # Licensed under the Universal Permissive License v 1.0 as shown at 5 | # httsp://oss.oracle.com/licenses/upl. 6 | # 7 | apiVersion: coherence.oracle.com/v1 8 | kind: Coherence 9 | metadata: 10 | name: todo-list 11 | spec: 12 | replicas: 1 13 | image: ghcr.io/coherence-community/todo-list-micronaut-server:24.09 14 | imagePullPolicy: Always 15 | env: 16 | - name: TRACING_HOST 17 | value: "jaeger-collector" 18 | - name: JAEGER_SAMPLER_TYPE 19 | value: "const" 20 | - name: JAEGER_SAMPLER_PARAM 21 | value: "1" 22 | application: 23 | type: helidon 24 | coherence: 25 | persistence: 26 | mode: active 27 | persistentVolumeClaim: 28 | accessModes: 29 | - ReadWriteOnce 30 | resources: 31 | requests: 32 | storage: 1Gi 33 | jvm: 34 | memory: 35 | heapSize: 512m 36 | ports: 37 | - name: grpc 38 | port: 1408 39 | - name: http 40 | port: 7001 41 | serviceMonitor: 42 | enabled: true 43 | 44 | -------------------------------------------------------------------------------- /java/coherence-server/src/main/k8s/ingress-nginx.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2020, 2021, Oracle and/or its affiliates. 3 | # 4 | # Licensed under the Universal Permissive License v 1.0 as shown at 5 | # http://oss.oracle.com/licenses/upl. 6 | # 7 | apiVersion: networking.k8s.io/v1 8 | kind: Ingress 9 | metadata: 10 | name: grpc-ingress 11 | annotations: 12 | nginx.ingress.kubernetes.io/backend-protocol: "GRPC" 13 | spec: 14 | ingressClassName: nginx 15 | rules: 16 | - host: grpc.todo.coherence.community 17 | http: 18 | paths: 19 | - pathType: ImplementationSpecific 20 | backend: 21 | service: 22 | name: todo-list-grpc 23 | port: 24 | name: grpc 25 | --- 26 | apiVersion: networking.k8s.io/v1 27 | kind: Ingress 28 | metadata: 29 | name: jaeger-ingress 30 | spec: 31 | ingressClassName: nginx 32 | rules: 33 | - host: jaeger.todo.coherence.community 34 | http: 35 | paths: 36 | - pathType: ImplementationSpecific 37 | backend: 38 | service: 39 | name: jaeger-query 40 | port: 41 | name: query 42 | --- 43 | -------------------------------------------------------------------------------- /java/helidon-client/src/main/resources/pof-config.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 12 | 13 | coherence-pof-config.xml 14 | 15 | 16 | 17653 17 | com.google.protobuf.MessageLite 18 | 19 | 20 | com.oracle.coherence.examples.todo.client.io.MessagePofSerializer 21 | 22 | 23 | 24 | 25 | 26 | true 27 | true 28 | true 29 | true 30 | -------------------------------------------------------------------------------- /java/helidon-server/src/main/resources/pof-config.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 12 | 13 | coherence-pof-config.xml 14 | 15 | 16 | 17653 17 | com.google.protobuf.MessageLite 18 | 19 | 20 | com.oracle.coherence.examples.todo.server.io.MessagePofSerializer 21 | 22 | 23 | 24 | 25 | 26 | true 27 | true 28 | true 29 | true 30 | -------------------------------------------------------------------------------- /java/spring-server/src/main/resources/pof-config.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 12 | 13 | coherence-pof-config.xml 14 | 15 | 16 | 17653 17 | com.google.protobuf.MessageLite 18 | 19 | 20 | com.oracle.coherence.examples.todo.server.serializer.MessagePofSerializer 21 | 22 | 23 | 24 | 25 | 26 | true 27 | true 28 | true 29 | true 30 | -------------------------------------------------------------------------------- /java/coherence-server/src/main/k8s/app.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2020, 2022, Oracle and/or its affiliates. 3 | # 4 | # Licensed under the Universal Permissive License v 1.0 as shown at 5 | # https://oss.oracle.com/licenses/upl. 6 | # 7 | apiVersion: coherence.oracle.com/v1 8 | kind: Coherence 9 | metadata: 10 | name: todo-list 11 | spec: 12 | cluster: ToDo-Coherence 13 | replicas: 1 14 | image: ghcr.io/coherence-community/todo-list-coherence-server:24.09 15 | imagePullPolicy: Always 16 | env: 17 | - name: TRACING_HOST 18 | value: "jaeger-collector" 19 | - name: JAEGER_SAMPLER_TYPE 20 | value: "const" 21 | - name: JAEGER_SAMPLER_PARAM 22 | value: "1" 23 | coherence: 24 | metrics: 25 | enabled: true 26 | # persistence: 27 | # mode: active 28 | # persistentVolumeClaim: 29 | # storageClassName: "oci-bv" 30 | # accessModes: 31 | # - ReadWriteOnce 32 | # resources: 33 | # requests: 34 | # storage: 50Gi 35 | jvm: 36 | memory: 37 | heapSize: 1g 38 | ports: 39 | - name: grpc 40 | port: 1408 41 | - name: metrics 42 | serviceMonitor: 43 | enabled: true 44 | 45 | -------------------------------------------------------------------------------- /py/README.md: -------------------------------------------------------------------------------- 1 | ## Coherence To Do List Example Using `coherence-py-client` 2 | 3 | ### Overview 4 | 5 | ### Prerequisites 6 | 7 | In order run the example, you must have the following installed: 8 | * Python 3.11 or later 9 | 10 | ### Setup Instructions 11 | 12 | 1. Install the required libraries 13 | ```bash 14 | python3 -m pip install -r requirements.txt 15 | ``` 16 | 17 | ### Running the Example 18 | 19 | 1. Start the Coherence server. See the java [README](../java/README.md) for details. 20 | 21 | 2. Start the Quart server on port 7003: 22 | ```bash 23 | python3 app.py 24 | ``` 25 | The start process should look something like: 26 | 27 | ``` 28 | (venv) bash-3.2$ python3 app.py 29 | * Serving Quart app 'app' 30 | * Environment: production 31 | * Please use an ASGI server (e.g. Hypercorn) directly in production 32 | * Debug mode: False 33 | * Running on http://127.0.0.1:7003 (CTRL + C to quit) 34 | [2023-05-06 11:51:24 -0700] [63382] [INFO] Running on http://127.0.0.1:7003 (CTRL + C to quit) 35 | ``` 36 | 37 | 4. Access the Web UI via [http://localhost:7003](http://localhost:7003) 38 | 39 | ![To Do List - React Client](../assets/react-client.png) -------------------------------------------------------------------------------- /java/helidon-server/src/main/java/com/oracle/coherence/examples/todo/server/TaskRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | package com.oracle.coherence.examples.todo.server; 9 | 10 | import com.oracle.coherence.repository.AbstractRepository; 11 | 12 | import com.tangosol.net.NamedMap; 13 | 14 | import jakarta.enterprise.context.ApplicationScoped; 15 | 16 | import jakarta.inject.Inject; 17 | 18 | /** 19 | * Implementation of a Coherence repository that manages access to Tasks. 20 | * 21 | * @author Aleks Seovic 2021.02.27 22 | */ 23 | @ApplicationScoped 24 | public class TaskRepository extends AbstractRepository 25 | { 26 | @Inject 27 | private NamedMap tasks; 28 | 29 | protected NamedMap getMap() 30 | { 31 | return tasks; 32 | } 33 | 34 | protected String getId(Task task) 35 | { 36 | return task.getId(); 37 | } 38 | 39 | protected Class getEntityType() 40 | { 41 | return Task.class; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /java/coherence-client/src/test/java/com/oracle/coherence/examples/todo/client/TaskTest.java: -------------------------------------------------------------------------------- 1 | package com.oracle.coherence.examples.todo.client; 2 | 3 | import com.tangosol.io.pof.ConfigurablePofContext; 4 | import com.tangosol.util.Binary; 5 | import com.tangosol.util.ExternalizableHelper; 6 | import org.junit.jupiter.api.Test; 7 | 8 | import static org.hamcrest.CoreMatchers.is; 9 | import static org.hamcrest.CoreMatchers.notNullValue; 10 | import static org.hamcrest.MatcherAssert.assertThat; 11 | 12 | public class TaskTest 13 | { 14 | @Test 15 | public void shouldImplementPortableObject() 16 | { 17 | Task task = new Task("test task"); 18 | task.setCompleted(true); 19 | 20 | ConfigurablePofContext pofContext = new ConfigurablePofContext(); 21 | Binary binary = ExternalizableHelper.toBinary(task, pofContext); 22 | Task result = ExternalizableHelper.fromBinary(binary, pofContext); 23 | assertThat(result, is(notNullValue())); 24 | assertThat(result.getDescription(), is(task.getDescription())); 25 | assertThat(result.getCreatedAt(), is(task.getCreatedAt())); 26 | assertThat(result.isCompleted(), is(task.isCompleted())); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /java/helidon-server/src/test/java/com/oracle/coherence/examples/todo/server/TaskTest.java: -------------------------------------------------------------------------------- 1 | package com.oracle.coherence.examples.todo.server; 2 | 3 | import com.tangosol.io.pof.ConfigurablePofContext; 4 | import com.tangosol.util.Binary; 5 | import com.tangosol.util.ExternalizableHelper; 6 | import org.junit.jupiter.api.Test; 7 | 8 | import static org.hamcrest.CoreMatchers.is; 9 | import static org.hamcrest.CoreMatchers.notNullValue; 10 | import static org.hamcrest.MatcherAssert.assertThat; 11 | 12 | public class TaskTest 13 | { 14 | @Test 15 | public void shouldImplementPortableObject() 16 | { 17 | Task task = new Task("test task") 18 | .setCompleted(true); 19 | 20 | ConfigurablePofContext pofContext = new ConfigurablePofContext(); 21 | Binary binary = ExternalizableHelper.toBinary(task, pofContext); 22 | Task result = ExternalizableHelper.fromBinary(binary, pofContext); 23 | assertThat(result, is(notNullValue())); 24 | assertThat(result.getDescription(), is(task.getDescription())); 25 | assertThat(result.getCreatedAt(), is(task.getCreatedAt())); 26 | assertThat(result.getCompleted(), is(task.getCompleted())); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /java/helidon-server/src/main/web/react/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "todo-application", 3 | "version": "1.0.0", 4 | "private": true, 5 | "dependencies": { 6 | "classnames": "^2.2.6", 7 | "prop-types": "^15.7.2", 8 | "react": "^16.13.1", 9 | "react-dom": "^16.13.1", 10 | "react-redux": "^7.2.1", 11 | "react-scripts": "^5.0", 12 | "redux": "^4.0.5", 13 | "redux-logger": "^3.0.6", 14 | "redux-thunk": "^2.3.0", 15 | "superagent": "^5.3.1", 16 | "typescript": "^3.9.7", 17 | "uuid": "^8.3.0" 18 | }, 19 | "devDependencies": { 20 | "@babel/plugin-proposal-class-properties": "^7.10.1", 21 | "@babel/plugin-proposal-object-rest-spread": "^7.10.1" 22 | }, 23 | "scripts": { 24 | "start": "react-scripts start", 25 | "build": "react-scripts build", 26 | "test": "react-scripts test", 27 | "eject": "react-scripts eject" 28 | }, 29 | "eslintConfig": { 30 | "extends": "react-app" 31 | }, 32 | "browserslist": { 33 | "production": [ 34 | ">0.2%", 35 | "not dead", 36 | "not op_mini all" 37 | ], 38 | "development": [ 39 | "last 1 chrome version", 40 | "last 1 firefox version", 41 | "last 1 safari version" 42 | ] 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /java/micronaut-server/src/main/web/react/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "todo-application", 3 | "version": "1.0.0", 4 | "private": true, 5 | "dependencies": { 6 | "classnames": "^2.2.6", 7 | "prop-types": "^15.7.2", 8 | "react": "^16.13.1", 9 | "react-dom": "^16.13.1", 10 | "react-redux": "^7.2.1", 11 | "react-scripts": "^5.0", 12 | "redux": "^4.0.5", 13 | "redux-logger": "^3.0.6", 14 | "redux-thunk": "^2.3.0", 15 | "superagent": "^5.3.1", 16 | "typescript": "^3.9.7", 17 | "uuid": "^8.3.0" 18 | }, 19 | "devDependencies": { 20 | "@babel/plugin-proposal-class-properties": "^7.10.1", 21 | "@babel/plugin-proposal-object-rest-spread": "^7.10.1" 22 | }, 23 | "scripts": { 24 | "start": "react-scripts start", 25 | "build": "react-scripts build", 26 | "test": "react-scripts test", 27 | "eject": "react-scripts eject" 28 | }, 29 | "eslintConfig": { 30 | "extends": "react-app" 31 | }, 32 | "browserslist": { 33 | "production": [ 34 | ">0.2%", 35 | "not dead", 36 | "not op_mini all" 37 | ], 38 | "development": [ 39 | "last 1 chrome version", 40 | "last 1 firefox version", 41 | "last 1 safari version" 42 | ] 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /java/spring-server/src/main/web/react/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "todo-application", 3 | "version": "1.0.0", 4 | "private": true, 5 | "dependencies": { 6 | "classnames": "^2.2.6", 7 | "prop-types": "^15.7.2", 8 | "react": "^16.13.1", 9 | "react-dom": "^16.13.1", 10 | "react-redux": "^7.2.1", 11 | "react-scripts": "^5.0", 12 | "redux": "^4.0.5", 13 | "redux-logger": "^3.0.6", 14 | "redux-thunk": "^2.3.0", 15 | "superagent": "^5.3.1", 16 | "typescript": "^3.9.7", 17 | "uuid": "^8.3.0" 18 | }, 19 | "devDependencies": { 20 | "@babel/plugin-proposal-class-properties": "^7.10.1", 21 | "@babel/plugin-proposal-object-rest-spread": "^7.10.1" 22 | }, 23 | "scripts": { 24 | "start": "react-scripts start", 25 | "build": "react-scripts build", 26 | "test": "react-scripts test", 27 | "eject": "react-scripts eject" 28 | }, 29 | "eslintConfig": { 30 | "extends": "react-app" 31 | }, 32 | "browserslist": { 33 | "production": [ 34 | ">0.2%", 35 | "not dead", 36 | "not op_mini all" 37 | ], 38 | "development": [ 39 | "last 1 chrome version", 40 | "last 1 firefox version", 41 | "last 1 safari version" 42 | ] 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /java/coherence-server/src/test/java/com/oracle/coherence/examples/todo/server/TaskTest.java: -------------------------------------------------------------------------------- 1 | package com.oracle.coherence.examples.todo.server; 2 | 3 | import com.tangosol.io.pof.ConfigurablePofContext; 4 | import com.tangosol.util.Binary; 5 | import com.tangosol.util.ExternalizableHelper; 6 | import org.junit.jupiter.api.Test; 7 | 8 | import static org.hamcrest.CoreMatchers.is; 9 | import static org.hamcrest.CoreMatchers.notNullValue; 10 | import static org.hamcrest.MatcherAssert.assertThat; 11 | 12 | public class TaskTest 13 | { 14 | @Test 15 | public void shouldImplementPortableObject() 16 | { 17 | Task task = new Task("test task") 18 | .setCompleted(true); 19 | 20 | ConfigurablePofContext pofContext = new ConfigurablePofContext(); 21 | Binary binary = ExternalizableHelper.toBinary(task, pofContext); 22 | Task result = ExternalizableHelper.fromBinary(binary, pofContext); 23 | assertThat(result, is(notNullValue())); 24 | assertThat(result.getDescription(), is(task.getDescription())); 25 | assertThat(result.getCreatedAt(), is(task.getCreatedAt())); 26 | assertThat(result.getCompleted(), is(task.getCompleted())); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /js/src/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | import React from 'react'; 9 | import ReactDOM from 'react-dom'; 10 | import thunkMiddleware from 'redux-thunk' 11 | import { createLogger } from 'redux-logger' 12 | import { createStore, applyMiddleware } from 'redux' 13 | import { Provider } from 'react-redux' 14 | import App from './components/App' 15 | import reducer from './reducers' 16 | import * as serviceWorker from './serviceWorker'; 17 | 18 | const loggerMiddleware = createLogger(); 19 | 20 | const store = createStore( 21 | reducer, 22 | applyMiddleware( 23 | thunkMiddleware, // lets us dispatch() functions 24 | loggerMiddleware // neat middleware that logs actions 25 | ) 26 | ); 27 | 28 | ReactDOM.render( 29 | 30 | 31 | , 32 | document.getElementById('root') 33 | ); 34 | 35 | // If you want your app to work offline and load faster, you can change 36 | // unregister() to register() below. Note this comes with some pitfalls. 37 | // Learn more about service workers: https://bit.ly/CRA-PWA 38 | serviceWorker.unregister(); 39 | -------------------------------------------------------------------------------- /java/helidon-server/src/main/web/react/src/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | import React from 'react'; 9 | import ReactDOM from 'react-dom'; 10 | import thunkMiddleware from 'redux-thunk' 11 | import { createLogger } from 'redux-logger' 12 | import { createStore, applyMiddleware } from 'redux' 13 | import { Provider } from 'react-redux' 14 | import App from './components/App' 15 | import reducer from './reducers' 16 | import * as serviceWorker from './serviceWorker'; 17 | 18 | const loggerMiddleware = createLogger(); 19 | 20 | const store = createStore( 21 | reducer, 22 | applyMiddleware( 23 | thunkMiddleware, // lets us dispatch() functions 24 | loggerMiddleware // neat middleware that logs actions 25 | ) 26 | ); 27 | 28 | ReactDOM.render( 29 | 30 | 31 | , 32 | document.getElementById('root') 33 | ); 34 | 35 | // If you want your app to work offline and load faster, you can change 36 | // unregister() to register() below. Note this comes with some pitfalls. 37 | // Learn more about service workers: https://bit.ly/CRA-PWA 38 | serviceWorker.unregister(); 39 | -------------------------------------------------------------------------------- /java/spring-server/src/main/k8s/app.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2021, 2022 Oracle and/or its affiliates. 3 | # 4 | # Licensed under the Universal Permissive License v 1.0 as shown at 5 | # https://oss.oracle.com/licenses/upl. 6 | # 7 | apiVersion: coherence.oracle.com/v1 8 | kind: Coherence 9 | metadata: 10 | name: todo-list 11 | spec: 12 | cluster: todo-list 13 | replicas: 1 14 | image: ghcr.io/coherence-community/todo-list-spring-server:24.09 15 | imagePullPolicy: Always 16 | env: 17 | - name: OTEL_EXPORTER_OTLP_PROTOCOL 18 | value: "grpc" 19 | - name: OTEL_EXPORTER_OTLP_ENDPOINT 20 | value: "http://jaeger-collector:4317" 21 | application: 22 | type: java 23 | coherence: 24 | metrics: 25 | enabled: true 26 | # persistence: 27 | # mode: active 28 | # persistentVolumeClaim: 29 | # storageClassName: "oci-bv" 30 | # accessModes: 31 | # - ReadWriteOnce 32 | # resources: 33 | # requests: 34 | # storage: 50Gi 35 | jvm: 36 | memory: 37 | heapSize: 1g 38 | ports: 39 | - name: grpc 40 | port: 1408 41 | - name: http 42 | port: 3000 43 | serviceMonitor: 44 | enabled: true 45 | - name: metrics 46 | serviceMonitor: 47 | enabled: true 48 | -------------------------------------------------------------------------------- /java/spring-server/src/main/web/react/src/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | import React from 'react'; 9 | import ReactDOM from 'react-dom'; 10 | import thunkMiddleware from 'redux-thunk' 11 | import { createLogger } from 'redux-logger' 12 | import { createStore, applyMiddleware } from 'redux' 13 | import { Provider } from 'react-redux' 14 | import App from './components/App' 15 | import reducer from './reducers' 16 | import * as serviceWorker from './serviceWorker'; 17 | 18 | const loggerMiddleware = createLogger(); 19 | 20 | const store = createStore( 21 | reducer, 22 | applyMiddleware( 23 | thunkMiddleware, // lets us dispatch() functions 24 | loggerMiddleware // neat middleware that logs actions 25 | ) 26 | ); 27 | 28 | ReactDOM.render( 29 | 30 | 31 | , 32 | document.getElementById('root') 33 | ); 34 | 35 | // If you want your app to work offline and load faster, you can change 36 | // unregister() to register() below. Note this comes with some pitfalls. 37 | // Learn more about service workers: https://bit.ly/CRA-PWA 38 | serviceWorker.unregister(); 39 | -------------------------------------------------------------------------------- /java/helidon-server/src/main/k8s/app.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2020, 2022, Oracle and/or its affiliates. 3 | # 4 | # Licensed under the Universal Permissive License v 1.0 as shown at 5 | # https://oss.oracle.com/licenses/upl. 6 | # 7 | apiVersion: coherence.oracle.com/v1 8 | kind: Coherence 9 | metadata: 10 | name: todo-list 11 | spec: 12 | cluster: ToDo-Helidon 13 | replicas: 1 14 | image: ghcr.io/coherence-community/todo-list-helidon-server:24.09 15 | env: 16 | - name: TRACING_HOST 17 | value: "jaeger-collector" 18 | - name: JAEGER_SAMPLER_TYPE 19 | value: "const" 20 | - name: JAEGER_SAMPLER_PARAM 21 | value: "1" 22 | application: 23 | type: helidon 24 | coherence: 25 | metrics: 26 | enabled: true 27 | # persistence: 28 | # mode: active 29 | # persistentVolumeClaim: 30 | # storageClassName: "oci-bv" 31 | # accessModes: 32 | # - ReadWriteOnce 33 | # resources: 34 | # requests: 35 | # storage: 50Gi 36 | jvm: 37 | memory: 38 | heapSize: 1g 39 | ports: 40 | - name: grpc 41 | port: 1408 42 | - name: http 43 | port: 7001 44 | serviceMonitor: 45 | enabled: true 46 | - name: metrics 47 | serviceMonitor: 48 | enabled: true 49 | -------------------------------------------------------------------------------- /java/micronaut-server/src/main/web/react/src/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | import React from 'react'; 9 | import ReactDOM from 'react-dom'; 10 | import thunkMiddleware from 'redux-thunk' 11 | import { createLogger } from 'redux-logger' 12 | import { createStore, applyMiddleware } from 'redux' 13 | import { Provider } from 'react-redux' 14 | import App from './components/App' 15 | import reducer from './reducers' 16 | import * as serviceWorker from './serviceWorker'; 17 | 18 | const loggerMiddleware = createLogger(); 19 | 20 | const store = createStore( 21 | reducer, 22 | applyMiddleware( 23 | thunkMiddleware, // lets us dispatch() functions 24 | loggerMiddleware // neat middleware that logs actions 25 | ) 26 | ); 27 | 28 | ReactDOM.render( 29 | 30 | 31 | , 32 | document.getElementById('root') 33 | ); 34 | 35 | // If you want your app to work offline and load faster, you can change 36 | // unregister() to register() below. Note this comes with some pitfalls. 37 | // Learn more about service workers: https://bit.ly/CRA-PWA 38 | serviceWorker.unregister(); 39 | -------------------------------------------------------------------------------- /java/micronaut-server/src/main/k8s/app.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2021, 2022 Oracle and/or its affiliates. 3 | # 4 | # Licensed under the Universal Permissive License v 1.0 as shown at 5 | # https://oss.oracle.com/licenses/upl. 6 | # 7 | apiVersion: coherence.oracle.com/v1 8 | kind: Coherence 9 | metadata: 10 | name: todo-list 11 | spec: 12 | cluster: ToDo-Micronaut 13 | replicas: 1 14 | image: ghcr.io/coherence-community/todo-list-micronaut-server:24.09 15 | env: 16 | - name: TRACING_HOST 17 | value: "jaeger-collector" 18 | - name: JAEGER_SAMPLER_TYPE 19 | value: "const" 20 | - name: JAEGER_SAMPLER_PARAM 21 | value: "1" 22 | application: 23 | type: java 24 | coherence: 25 | metrics: 26 | enabled: true 27 | # persistence: 28 | # mode: active 29 | # persistentVolumeClaim: 30 | # storageClassName: "oci-bv" 31 | # accessModes: 32 | # - ReadWriteOnce 33 | # resources: 34 | # requests: 35 | # storage: 50Gi 36 | jvm: 37 | memory: 38 | heapSize: 1g 39 | ports: 40 | - name: grpc 41 | port: 1408 42 | - name: http 43 | port: 3000 44 | serviceMonitor: 45 | enabled: true 46 | - name: metrics 47 | serviceMonitor: 48 | enabled: true 49 | 50 | -------------------------------------------------------------------------------- /java/helidon-server/src/main/microk8s/ingress-traefik.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2020, 2021, Oracle and/or its affiliates. 3 | # 4 | # Licensed under the Universal Permissive License v 1.0 as shown at 5 | # http://oss.oracle.com/licenses/upl. 6 | # 7 | apiVersion: networking.k8s.io/v1beta1 8 | kind: Ingress 9 | metadata: 10 | name: http-ingress 11 | annotations: 12 | # nginx.ingress.kubernetes.io/rewrite-target: / ## figure out how to rewrite URLs with Traefik 13 | kubernetes.io/ingress.class: traefik 14 | spec: 15 | rules: 16 | - host: todo-app.microk8s 17 | http: 18 | paths: 19 | - path: /jaeger 20 | pathType: Prefix 21 | backend: 22 | serviceName: jaeger-query 23 | servicePort: 16686 24 | - path: / 25 | pathType: Prefix 26 | backend: 27 | serviceName: todo-list-http 28 | servicePort: 7001 29 | --- 30 | apiVersion: networking.k8s.io/v1beta1 31 | kind: Ingress 32 | metadata: 33 | name: grpc-ingress 34 | annotations: 35 | kubernetes.io/ingress.class: traefik 36 | ingress.kubernetes.io/protocol: h2c 37 | spec: 38 | rules: 39 | - host: todo-grpc.microk8s 40 | http: 41 | paths: 42 | - backend: 43 | serviceName: todo-list-grpc 44 | servicePort: 1408 45 | 46 | -------------------------------------------------------------------------------- /java/micronaut-server/src/test/java/com/oracle/coherence/examples/todo/server/TodoListIT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | package com.oracle.coherence.examples.todo.server; 8 | 9 | import com.oracle.coherence.examples.todo.test.common.BaseTodoListTests; 10 | 11 | import io.micronaut.context.ApplicationContext; 12 | 13 | import io.micronaut.runtime.server.EmbeddedServer; 14 | 15 | import io.micronaut.test.extensions.junit5.annotation.MicronautTest; 16 | 17 | import jakarta.inject.Inject; 18 | 19 | @MicronautTest(application=Application.class) 20 | public class TodoListIT 21 | extends BaseTodoListTests 22 | { 23 | // ----- helper methods ------------------------------------------------- 24 | 25 | @Override 26 | protected String getUrl() 27 | { 28 | return server.getURL().toString(); 29 | } 30 | 31 | // ----- data members --------------------------------------------------- 32 | 33 | /** 34 | * The server under test. 35 | */ 36 | @Inject 37 | EmbeddedServer server; 38 | 39 | /** 40 | * The application context. 41 | */ 42 | @Inject 43 | ApplicationContext ctx; 44 | } 45 | -------------------------------------------------------------------------------- /java/spring-server/src/main/java/com/oracle/coherence/examples/todo/server/service/TaskNotFoundException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | package com.oracle.coherence.examples.todo.server.service; 8 | 9 | import graphql.ErrorClassification; 10 | import graphql.GraphQLError; 11 | import graphql.language.SourceLocation; 12 | 13 | import java.util.List; 14 | 15 | /** 16 | * An exception indicating that a {@link com.oracle.coherence.examples.todo.server.model.Task} was not found. 17 | * @author Gunnar Hillert 18 | */ 19 | public class TaskNotFoundException 20 | extends RuntimeException implements GraphQLError 21 | { 22 | /** 23 | * Create the exception. 24 | * 25 | * @param message reason for the exception. 26 | */ 27 | public TaskNotFoundException(String message) 28 | { 29 | super(message); 30 | } 31 | 32 | @Override 33 | public List getLocations() 34 | { 35 | return null; 36 | } 37 | 38 | @Override 39 | public ErrorClassification getErrorType() 40 | { 41 | return null; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /js/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "todos-js", 3 | "version": "1.0.0", 4 | "private": true, 5 | "dependencies": { 6 | "@oracle/coherence": "^1.2", 7 | "@toverux/expresse": "^2.4.0", 8 | "classnames": "^2.2.6", 9 | "express": "^4.17.1", 10 | "prop-types": "^15.7.2", 11 | "react": "^16.13.1", 12 | "react-dom": "^16.13.1", 13 | "react-redux": "^7.2.1", 14 | "react-scripts": "^5.0", 15 | "redux": "^4.0.5", 16 | "redux-logger": "^3.0.6", 17 | "redux-thunk": "^2.3.0", 18 | "superagent": "^5.3.1", 19 | "typescript": "^3.9.7", 20 | "uuid": "^8.3.0" 21 | }, 22 | "devDependencies": { 23 | "@babel/plugin-proposal-class-properties": "^7.10.1", 24 | "@babel/plugin-proposal-object-rest-spread": "^7.10.1" 25 | }, 26 | "scripts": { 27 | "start": "node --trace-warnings server.js", 28 | "build": "react-scripts build", 29 | "test": "react-scripts test", 30 | "eject": "react-scripts eject", 31 | "prepare": "react-scripts build" 32 | }, 33 | "eslintConfig": { 34 | "extends": "react-app" 35 | }, 36 | "browserslist": { 37 | "production": [ 38 | ">0.2%", 39 | "not dead", 40 | "not op_mini all" 41 | ], 42 | "development": [ 43 | "last 1 chrome version", 44 | "last 1 firefox version", 45 | "last 1 safari version" 46 | ] 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /js/src/reducers/todos.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | import { INIT_TODOS, ADD_TODO, DELETE_TODO, UPDATE_TODO, COMPLETE_TODO, CLEAR_COMPLETED } from '../constants/ActionTypes' 9 | 10 | export default function todos(state = [], action = null) { 11 | switch (action.type) { 12 | case INIT_TODOS: 13 | return action.todos || []; 14 | 15 | case ADD_TODO: 16 | return [ 17 | { 18 | id: action.id, 19 | createdAt: action.createdAt, 20 | completed: false, 21 | description: action.description 22 | }, 23 | ...state 24 | ]; 25 | 26 | case DELETE_TODO: 27 | return state.filter(todo => 28 | todo.id !== action.id 29 | ); 30 | 31 | case UPDATE_TODO: 32 | return state.map(todo => 33 | todo.id === action.id ? 34 | { ...todo, description: action.description } : 35 | todo 36 | ); 37 | 38 | case COMPLETE_TODO: 39 | return state.map(todo => 40 | todo.id === action.id ? 41 | { ...todo, completed: action.completed } : 42 | todo 43 | ); 44 | 45 | case CLEAR_COMPLETED: 46 | return state.filter(todo => todo.completed === false); 47 | 48 | default: 49 | return state; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /java/coherence-client/src/test/java/com/oracle/coherence/examples/todo/client/ConsoleLogConsumer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2000, 2022, Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | package com.oracle.coherence.examples.todo.client; 8 | 9 | import com.oracle.bedrock.runtime.ApplicationConsole; 10 | import org.testcontainers.containers.output.BaseConsumer; 11 | import org.testcontainers.containers.output.OutputFrame; 12 | 13 | import java.util.Objects; 14 | 15 | /** 16 | * A Testcontainers log consumer to write logs to a Bedrock {@link ApplicationConsole}. 17 | */ 18 | public class ConsoleLogConsumer 19 | extends BaseConsumer 20 | { 21 | public ConsoleLogConsumer(ApplicationConsole console) 22 | { 23 | m_console = Objects.requireNonNull(console); 24 | } 25 | 26 | @Override 27 | public void accept(OutputFrame outputFrame) 28 | { 29 | switch (outputFrame.getType()) 30 | { 31 | case STDOUT: 32 | m_console.getOutputWriter().print(outputFrame.getUtf8String()); 33 | break; 34 | case STDERR: 35 | m_console.getErrorWriter().print(outputFrame.getUtf8String()); 36 | break; 37 | } 38 | } 39 | 40 | private final ApplicationConsole m_console; 41 | } 42 | -------------------------------------------------------------------------------- /java/helidon-server/src/main/web/react/src/reducers/todos.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | import { INIT_TODOS, ADD_TODO, DELETE_TODO, UPDATE_TODO, COMPLETE_TODO, CLEAR_COMPLETED } from '../constants/ActionTypes' 9 | 10 | export default function todos(state = [], action = null) { 11 | switch (action.type) { 12 | case INIT_TODOS: 13 | return action.todos || []; 14 | 15 | case ADD_TODO: 16 | return [ 17 | { 18 | id: action.id, 19 | createdAt: action.createdAt, 20 | completed: false, 21 | description: action.description 22 | }, 23 | ...state 24 | ]; 25 | 26 | case DELETE_TODO: 27 | return state.filter(todo => 28 | todo.id !== action.id 29 | ); 30 | 31 | case UPDATE_TODO: 32 | return state.map(todo => 33 | todo.id === action.id ? 34 | { ...todo, description: action.description } : 35 | todo 36 | ); 37 | 38 | case COMPLETE_TODO: 39 | return state.map(todo => 40 | todo.id === action.id ? 41 | { ...todo, completed: action.completed } : 42 | todo 43 | ); 44 | 45 | case CLEAR_COMPLETED: 46 | return state.filter(todo => todo.completed === false); 47 | 48 | default: 49 | return state; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /java/micronaut-server/src/main/web/react/src/reducers/todos.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | import { INIT_TODOS, ADD_TODO, DELETE_TODO, UPDATE_TODO, COMPLETE_TODO, CLEAR_COMPLETED } from '../constants/ActionTypes' 9 | 10 | export default function todos(state = [], action = null) { 11 | switch (action.type) { 12 | case INIT_TODOS: 13 | return action.todos || []; 14 | 15 | case ADD_TODO: 16 | return [ 17 | { 18 | id: action.id, 19 | createdAt: action.createdAt, 20 | completed: false, 21 | description: action.description 22 | }, 23 | ...state 24 | ]; 25 | 26 | case DELETE_TODO: 27 | return state.filter(todo => 28 | todo.id !== action.id 29 | ); 30 | 31 | case UPDATE_TODO: 32 | return state.map(todo => 33 | todo.id === action.id ? 34 | { ...todo, description: action.description } : 35 | todo 36 | ); 37 | 38 | case COMPLETE_TODO: 39 | return state.map(todo => 40 | todo.id === action.id ? 41 | { ...todo, completed: action.completed } : 42 | todo 43 | ); 44 | 45 | case CLEAR_COMPLETED: 46 | return state.filter(todo => todo.completed === false); 47 | 48 | default: 49 | return state; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /java/spring-server/src/main/web/react/src/reducers/todos.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | import { INIT_TODOS, ADD_TODO, DELETE_TODO, UPDATE_TODO, COMPLETE_TODO, CLEAR_COMPLETED } from '../constants/ActionTypes' 9 | 10 | export default function todos(state = [], action = null) { 11 | switch (action.type) { 12 | case INIT_TODOS: 13 | return action.todos || []; 14 | 15 | case ADD_TODO: 16 | return [ 17 | { 18 | id: action.id, 19 | createdAt: action.createdAt, 20 | completed: false, 21 | description: action.description 22 | }, 23 | ...state 24 | ]; 25 | 26 | case DELETE_TODO: 27 | return state.filter(todo => 28 | todo.id !== action.id 29 | ); 30 | 31 | case UPDATE_TODO: 32 | return state.map(todo => 33 | todo.id === action.id ? 34 | { ...todo, description: action.description } : 35 | todo 36 | ); 37 | 38 | case COMPLETE_TODO: 39 | return state.map(todo => 40 | todo.id === action.id ? 41 | { ...todo, completed: action.completed } : 42 | todo 43 | ); 44 | 45 | case CLEAR_COMPLETED: 46 | return state.filter(todo => todo.completed === false); 47 | 48 | default: 49 | return state; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /java/helidon-server/src/main/web/jet/scripts/hooks/hooks.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "OJET-CLI hooks configuration file", 3 | "hooks": { 4 | "after_app_create": "scripts/hooks/after_app_create.js", 5 | "after_app_restore": "scripts/hooks/after_app_restore.js", 6 | "after_component_create": "scripts/hooks/after_component_create.js", 7 | "before_build": "scripts/hooks/before_build.js", 8 | "before_optimize": "scripts/hooks/before_optimize.js", 9 | "before_component_optimize": "scripts/hooks/before_component_optimize.js", 10 | "before_release": "scripts/hooks/before_release.js", 11 | "before_watch": "scripts/hooks/before_watch.js", 12 | "after_build": "scripts/hooks/after_build.js", 13 | "after_component_build": "scripts/hooks/after_component_build.js", 14 | "before_hybrid_build": "scripts/hooks/before_hybrid_build.js", 15 | "before_release_build": "scripts/hooks/before_release_build.js", 16 | "before_serve": "scripts/hooks/before_serve.js", 17 | "after_serve": "scripts/hooks/after_serve.js", 18 | "after_watch": "scripts/hooks/after_watch.js", 19 | "before_app_typescript": "scripts/hooks/before_app_typescript.js", 20 | "before_component_typescript": "scripts/hooks/before_component_typescript.js", 21 | "after_app_typescript": "scripts/hooks/after_app_typescript.js", 22 | "after_component_typescript": "scripts/hooks/after_component_typescript.js" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /java/spring-server/src/main/java/com/oracle/coherence/examples/todo/server/config/WebConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | package com.oracle.coherence.examples.todo.server.config; 8 | 9 | import com.zhokhov.graphql.datetime.LocalDateTimeScalar; 10 | import graphql.scalars.ExtendedScalars; 11 | import org.springframework.context.annotation.Bean; 12 | import org.springframework.context.annotation.Configuration; 13 | import org.springframework.graphql.execution.RuntimeWiringConfigurer; 14 | import org.springframework.web.servlet.config.annotation.CorsRegistry; 15 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 16 | 17 | /** 18 | * @author Gunnar Hillert 19 | */ 20 | @Configuration(proxyBeanMethods = false) 21 | public class WebConfig { 22 | 23 | @Bean 24 | public WebMvcConfigurer corsConfigurer() 25 | { 26 | return new WebMvcConfigurer() { 27 | @Override 28 | public void addCorsMappings(CorsRegistry registry) { 29 | registry 30 | .addMapping("/**") 31 | .allowedMethods("*") 32 | .allowedOrigins("*"); 33 | } 34 | }; 35 | } 36 | 37 | @Bean 38 | RuntimeWiringConfigurer runtimeWiringConfigurer() { 39 | return (wiringBuilder) -> wiringBuilder 40 | .scalar(ExtendedScalars.GraphQLBigInteger) 41 | .scalar(LocalDateTimeScalar.create("LocalDateTime", false, null)); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /java/coherence-server/README.md: -------------------------------------------------------------------------------- 1 | # Coherence To Do List Server Example 2 | 3 | ## Build Instructions 4 | 5 | The command below will build the server image. 6 | The image will be created with two tags `todo-list-coherence-server:latest` 7 | and `todo-list-coherence-server:${project.version}` 8 | 9 | ```bash 10 | mvn clean package -Pdocker 11 | ``` 12 | 13 | ## Run a Server Container 14 | 15 | The command below will run the image in a container named `todo-server` 16 | and expose Coherence gRPC on `localhost:1408`. 17 | 18 | ```bash 19 | docker run -d -p 1408:1408 --name todo-server ghcr.io/coherence-community/todo-list-coherence-server:latest 20 | ``` 21 | 22 | Running the `docker ps` command will display the status of the running image. 23 | 24 | ``` 25 | CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 26 | 0436f2dba284 todo-list-coherence-server:latest "java -cp /app/class…" 3 seconds ago Up 2 seconds (health: starting) 0.0.0.0:1408->1408/tcp, 9612/tcp todo-server 27 | ``` 28 | 29 | Initially the `STATUS` colum will show `(health: starting)`. 30 | Once the Coherence health checks have a status of "ready", the container status will change to `(healthy)` 31 | 32 | The Coherence client can now be run against the server image. 33 | 34 | ## Stop the Container 35 | 36 | To stop and remove the image run the following command: 37 | 38 | ```bash 39 | docker rm -f todo-server 40 | ``` 41 | -------------------------------------------------------------------------------- /java/coherence-server/src/main/assembly/image-assembly.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | image 5 | 6 | dir 7 | 8 | 9 | false 10 | 11 | 12 | 13 | 14 | target/classes 15 | app/classes 16 | 755 17 | false 18 | 19 | 20 | 21 | ${project.basedir}/src/main/docker 22 | 23 | 755 24 | 25 | 26 | 27 | 28 | 29 | 30 | app/libs 31 | 755 32 | 755 33 | false 34 | false 35 | 36 | ${artifact.artifactId}${dashClassifier?}.${artifact.extension} 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /java/helidon-server/src/main/k8s/ingress-nginx.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2020, 2022, Oracle and/or its affiliates. 3 | # 4 | # Licensed under the Universal Permissive License v 1.0 as shown at 5 | # http://oss.oracle.com/licenses/upl. 6 | # 7 | apiVersion: networking.k8s.io/v1 8 | kind: Ingress 9 | metadata: 10 | name: http-ingress 11 | spec: 12 | ingressClassName: nginx 13 | rules: 14 | - host: helidon.todo.coherence.community 15 | http: 16 | paths: 17 | - pathType: ImplementationSpecific 18 | backend: 19 | service: 20 | name: todo-list-http 21 | port: 22 | name: http 23 | --- 24 | apiVersion: networking.k8s.io/v1 25 | kind: Ingress 26 | metadata: 27 | name: grpc-ingress 28 | annotations: 29 | nginx.ingress.kubernetes.io/backend-protocol: "GRPC" 30 | spec: 31 | ingressClassName: nginx 32 | rules: 33 | - host: grpc.helidon.todo.coherence.community 34 | http: 35 | paths: 36 | - pathType: ImplementationSpecific 37 | backend: 38 | service: 39 | name: todo-list-grpc 40 | port: 41 | name: grpc 42 | --- 43 | apiVersion: networking.k8s.io/v1 44 | kind: Ingress 45 | metadata: 46 | name: jaeger-ingress 47 | spec: 48 | ingressClassName: nginx 49 | rules: 50 | - host: jaeger.helidon.todo.coherence.community 51 | http: 52 | paths: 53 | - pathType: ImplementationSpecific 54 | backend: 55 | service: 56 | name: jaeger-query 57 | port: 58 | name: query 59 | --- 60 | -------------------------------------------------------------------------------- /go/todo_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | package main 9 | 10 | import ( 11 | "bufio" 12 | . "github.com/onsi/gomega" 13 | "io" 14 | "sync" 15 | "testing" 16 | "time" 17 | ) 18 | 19 | // TestToDo tests the todo app. 20 | func TestToDo(t *testing.T) { 21 | g := NewWithT(t) 22 | var wg sync.WaitGroup 23 | initialize() 24 | defer shutdown() 25 | 26 | // create a pipe to send commands to 27 | reader, writer := io.Pipe() 28 | scanner := bufio.NewScanner(reader) 29 | wg.Add(1) 30 | go func() { 31 | runREPL(scanner) 32 | wg.Done() 33 | }() 34 | 35 | _, err := writer.Write([]byte("help\n")) 36 | g.Expect(err).Should(Not(HaveOccurred())) 37 | sleep(5) 38 | 39 | _, err = writer.Write([]byte("add get food\n")) 40 | g.Expect(err).Should(Not(HaveOccurred())) 41 | sleep(5) 42 | 43 | _, err = writer.Write([]byte("list\n")) 44 | g.Expect(err).Should(Not(HaveOccurred())) 45 | sleep(5) 46 | 47 | _, err = writer.Write([]byte("complete 1\n")) 48 | g.Expect(err).Should(Not(HaveOccurred())) 49 | sleep(5) 50 | 51 | _, err = writer.Write([]byte("clear\n")) 52 | g.Expect(err).Should(Not(HaveOccurred())) 53 | sleep(5) 54 | 55 | _, err = writer.Write([]byte("quit\n")) 56 | g.Expect(err).Should(Not(HaveOccurred())) 57 | sleep(5) 58 | 59 | wg.Wait() 60 | } 61 | 62 | // Sleep will sleep for a duration of seconds 63 | func sleep(seconds int) { 64 | time.Sleep(time.Duration(seconds) * time.Second) 65 | } 66 | -------------------------------------------------------------------------------- /java/micronaut-server/src/main/k8s/ingress-nginx.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2021, 2022, Oracle and/or its affiliates. 3 | # 4 | # Licensed under the Universal Permissive License v 1.0 as shown at 5 | # http://oss.oracle.com/licenses/upl. 6 | # 7 | apiVersion: networking.k8s.io/v1 8 | kind: Ingress 9 | metadata: 10 | name: http-ingress 11 | spec: 12 | ingressClassName: nginx 13 | rules: 14 | - host: micronaut.todo.coherence.community 15 | http: 16 | paths: 17 | - pathType: ImplementationSpecific 18 | backend: 19 | service: 20 | name: todo-list-http 21 | port: 22 | name: http 23 | --- 24 | apiVersion: networking.k8s.io/v1 25 | kind: Ingress 26 | metadata: 27 | name: grpc-ingress 28 | annotations: 29 | nginx.ingress.kubernetes.io/backend-protocol: "GRPC" 30 | spec: 31 | ingressClassName: nginx 32 | rules: 33 | - host: grpc.micronaut.todo.coherence.community 34 | http: 35 | paths: 36 | - pathType: ImplementationSpecific 37 | backend: 38 | service: 39 | name: todo-list-grpc 40 | port: 41 | name: grpc 42 | --- 43 | apiVersion: networking.k8s.io/v1 44 | kind: Ingress 45 | metadata: 46 | name: jaeger-ingress 47 | spec: 48 | ingressClassName: nginx 49 | rules: 50 | - host: jaeger.micronaut.todo.coherence.community 51 | http: 52 | paths: 53 | - pathType: ImplementationSpecific 54 | backend: 55 | service: 56 | name: jaeger-query 57 | port: 58 | name: query 59 | --- 60 | -------------------------------------------------------------------------------- /java/helidon-server/src/main/web/graphql/graphiql.html: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | 12 | Simple GraphiQL Example 13 | 14 | 15 | 16 |
17 | 18 | 22 | 26 | 30 | 31 | 45 | 46 | -------------------------------------------------------------------------------- /java/helidon-server/src/main/java/com/oracle/coherence/examples/todo/server/io/MessagePofSerializer.java: -------------------------------------------------------------------------------- 1 | package com.oracle.coherence.examples.todo.server.io; 2 | 3 | import com.google.protobuf.MessageLite; 4 | import com.google.protobuf.Parser; 5 | import com.tangosol.io.pof.PofReader; 6 | import com.tangosol.io.pof.PofSerializer; 7 | import com.tangosol.io.pof.PofWriter; 8 | import java.io.IOException; 9 | import java.lang.reflect.Method; 10 | 11 | /** 12 | * @author Aleks Seovic 2021.11.04 13 | */ 14 | public class MessagePofSerializer 15 | implements PofSerializer 16 | { 17 | public void serialize(PofWriter out, T msg) 18 | throws IOException 19 | { 20 | out.writeString(0, msg.getClass().getName()); 21 | out.writeByteArray(1, msg.toByteArray()); 22 | out.writeRemainder(null); 23 | } 24 | 25 | @SuppressWarnings("unchecked") 26 | public T deserialize(PofReader in) throws IOException 27 | { 28 | String sClassName = in.readString(0); 29 | byte[] abMsg = in.readByteArray(1); 30 | in.readRemainder(); 31 | 32 | try 33 | { 34 | Class clz = (Class) Class.forName(sClassName); 35 | Method methodParser = clz.getDeclaredMethod("parser"); 36 | Parser parser = (Parser) methodParser.invoke(clz); 37 | return parser.parseFrom(abMsg); 38 | } 39 | catch (Exception e) 40 | { 41 | throw new IOException(e); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /java/spring-server/src/main/java/com/oracle/coherence/examples/todo/server/repository/TaskRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | package com.oracle.coherence.examples.todo.server.repository; 8 | 9 | import com.oracle.coherence.examples.todo.server.model.Task; 10 | import com.oracle.coherence.spring.configuration.annotation.CoherenceMap; 11 | import com.tangosol.net.NamedMap; 12 | import org.springframework.context.annotation.Profile; 13 | import org.springframework.stereotype.Component; 14 | import com.oracle.coherence.repository.AbstractRepository; 15 | 16 | /** 17 | * A {@code Coherence}-based repository for working with {@link Task tasks}. This 18 | * implementation uses the Oracle Coherence repository support directly and is NOT 19 | * using Spring Data. 20 | * @author Gunnar Hillert 21 | * @see SpringDataTaskRepository 22 | */ 23 | @Component 24 | @Profile("coherence") 25 | public class TaskRepository extends AbstractRepository 26 | { 27 | 28 | @CoherenceMap 29 | private NamedMap tasks; 30 | 31 | @Override 32 | protected NamedMap getMap() 33 | { 34 | return this.tasks; 35 | } 36 | 37 | @Override 38 | protected String getId(Task entity) 39 | { 40 | return entity.getId(); 41 | } 42 | 43 | @Override 44 | protected Class getEntityType() 45 | { 46 | return Task.class; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /java/helidon-client/src/main/java/com/oracle/coherence/examples/todo/client/io/MessagePofSerializer.java: -------------------------------------------------------------------------------- 1 | package com.oracle.coherence.examples.todo.client.io; 2 | 3 | import com.google.protobuf.MessageLite; 4 | import com.google.protobuf.Parser; 5 | 6 | import com.tangosol.io.pof.PofReader; 7 | import com.tangosol.io.pof.PofSerializer; 8 | import com.tangosol.io.pof.PofWriter; 9 | 10 | import java.io.IOException; 11 | 12 | import java.lang.reflect.Method; 13 | 14 | /** 15 | * @author Aleks Seovic 2021.11.04 16 | */ 17 | public class MessagePofSerializer 18 | implements PofSerializer 19 | { 20 | public void serialize(PofWriter out, T msg) 21 | throws IOException 22 | { 23 | out.writeString(0, msg.getClass().getName()); 24 | out.writeByteArray(1, msg.toByteArray()); 25 | out.writeRemainder(null); 26 | } 27 | 28 | @SuppressWarnings("unchecked") 29 | public T deserialize(PofReader in) throws IOException 30 | { 31 | String sClassName = in.readString(0); 32 | byte[] abMsg = in.readByteArray(1); 33 | in.readRemainder(); 34 | 35 | try 36 | { 37 | Class clz = (Class) Class.forName(sClassName); 38 | Method methodParser = clz.getDeclaredMethod("parser"); 39 | Parser parser = (Parser) methodParser.invoke(clz); 40 | return parser.parseFrom(abMsg); 41 | } 42 | catch (Exception e) 43 | { 44 | throw new IOException(e); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /js/src/components/TodoTextInput.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | import React, { Component } from 'react' 9 | import classnames from 'classnames' 10 | import PropTypes from 'prop-types' 11 | 12 | export default class TodoTextInput extends Component { 13 | static propTypes = { 14 | onSave: PropTypes.func.isRequired, 15 | text: PropTypes.string, 16 | placeholder: PropTypes.string, 17 | editing: PropTypes.bool, 18 | newTodo: PropTypes.bool 19 | }; 20 | 21 | state = { 22 | text: this.props.text || '' 23 | }; 24 | 25 | handleSubmit = e => { 26 | const text = e.target.value.trim(); 27 | if (e.which === 13) { 28 | this.props.onSave(text); 29 | if (this.props.newTodo) { 30 | this.setState({ text: '' }) 31 | } 32 | } 33 | }; 34 | 35 | handleChange = e => { 36 | this.setState({ text: e.target.value }) 37 | }; 38 | 39 | handleBlur = e => { 40 | if (!this.props.newTodo) { 41 | this.props.onSave(e.target.value) 42 | } 43 | }; 44 | 45 | render() { 46 | return ( 47 | 59 | ) 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /java/spring-server/src/test/java/com/oracle/coherence/examples/todo/server/CoherenceMetricsDisabledTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | package com.oracle.coherence.examples.todo.server; 8 | 9 | import org.junit.jupiter.api.Order; 10 | import org.junit.jupiter.api.Test; 11 | import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient; 12 | import org.springframework.boot.test.context.SpringBootTest; 13 | import org.springframework.http.MediaType; 14 | import org.springframework.test.annotation.DirtiesContext; 15 | import org.springframework.web.reactive.function.client.WebClientRequestException; 16 | 17 | import static org.junit.jupiter.api.Assertions.assertThrows; 18 | 19 | /** 20 | * Basic integration test to ensure Coherence metrics are NOT available when 21 | * property {@code coherence.metrics.http.enabled} is not set. 22 | * 23 | * @author Gunnar Hillert 24 | * @see CoherenceMetricsEnabledTests 25 | * @see BaseCoherenceMetricsTests 26 | */ 27 | @SpringBootTest( 28 | webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT 29 | ) 30 | @AutoConfigureWebTestClient 31 | @DirtiesContext 32 | public class CoherenceMetricsDisabledTests extends BaseCoherenceMetricsTests { 33 | 34 | @Test 35 | @Order(3) 36 | void ensureMetricsEndpointIsNotAvailable() { 37 | assertThrows( 38 | WebClientRequestException.class, () -> webTestClient.get() 39 | .uri(COHERENCE_METRICS_URL) 40 | .accept(MediaType.APPLICATION_JSON) 41 | .exchange()); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /java/helidon-server/src/main/web/react/src/components/TodoTextInput.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | import React, { Component } from 'react' 9 | import classnames from 'classnames' 10 | import PropTypes from 'prop-types' 11 | 12 | export default class TodoTextInput extends Component { 13 | static propTypes = { 14 | onSave: PropTypes.func.isRequired, 15 | text: PropTypes.string, 16 | placeholder: PropTypes.string, 17 | editing: PropTypes.bool, 18 | newTodo: PropTypes.bool 19 | }; 20 | 21 | state = { 22 | text: this.props.text || '' 23 | }; 24 | 25 | handleSubmit = e => { 26 | const text = e.target.value.trim(); 27 | if (e.which === 13) { 28 | this.props.onSave(text); 29 | if (this.props.newTodo) { 30 | this.setState({ text: '' }) 31 | } 32 | } 33 | }; 34 | 35 | handleChange = e => { 36 | this.setState({ text: e.target.value }) 37 | }; 38 | 39 | handleBlur = e => { 40 | if (!this.props.newTodo) { 41 | this.props.onSave(e.target.value) 42 | } 43 | }; 44 | 45 | render() { 46 | return ( 47 | 59 | ) 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /java/spring-server/src/main/web/react/src/components/TodoTextInput.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | import React, { Component } from 'react' 9 | import classnames from 'classnames' 10 | import PropTypes from 'prop-types' 11 | 12 | export default class TodoTextInput extends Component { 13 | static propTypes = { 14 | onSave: PropTypes.func.isRequired, 15 | text: PropTypes.string, 16 | placeholder: PropTypes.string, 17 | editing: PropTypes.bool, 18 | newTodo: PropTypes.bool 19 | }; 20 | 21 | state = { 22 | text: this.props.text || '' 23 | }; 24 | 25 | handleSubmit = e => { 26 | const text = e.target.value.trim(); 27 | if (e.which === 13) { 28 | this.props.onSave(text); 29 | if (this.props.newTodo) { 30 | this.setState({ text: '' }) 31 | } 32 | } 33 | }; 34 | 35 | handleChange = e => { 36 | this.setState({ text: e.target.value }) 37 | }; 38 | 39 | handleBlur = e => { 40 | if (!this.props.newTodo) { 41 | this.props.onSave(e.target.value) 42 | } 43 | }; 44 | 45 | render() { 46 | return ( 47 | 59 | ) 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /java/micronaut-server/src/main/web/react/src/components/TodoTextInput.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | import React, { Component } from 'react' 9 | import classnames from 'classnames' 10 | import PropTypes from 'prop-types' 11 | 12 | export default class TodoTextInput extends Component { 13 | static propTypes = { 14 | onSave: PropTypes.func.isRequired, 15 | text: PropTypes.string, 16 | placeholder: PropTypes.string, 17 | editing: PropTypes.bool, 18 | newTodo: PropTypes.bool 19 | }; 20 | 21 | state = { 22 | text: this.props.text || '' 23 | }; 24 | 25 | handleSubmit = e => { 26 | const text = e.target.value.trim(); 27 | if (e.which === 13) { 28 | this.props.onSave(text); 29 | if (this.props.newTodo) { 30 | this.setState({ text: '' }) 31 | } 32 | } 33 | }; 34 | 35 | handleChange = e => { 36 | this.setState({ text: e.target.value }) 37 | }; 38 | 39 | handleBlur = e => { 40 | if (!this.props.newTodo) { 41 | this.props.onSave(e.target.value) 42 | } 43 | }; 44 | 45 | render() { 46 | return ( 47 | 59 | ) 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /java/spring-server/src/main/k8s/ingress-nginx.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2021, 2022, Oracle and/or its affiliates. 3 | # 4 | # Licensed under the Universal Permissive License v 1.0 as shown at 5 | # http://oss.oracle.com/licenses/upl. 6 | # 7 | apiVersion: networking.k8s.io/v1 8 | kind: Ingress 9 | metadata: 10 | name: http-ingress 11 | spec: 12 | ingressClassName: nginx 13 | tls: 14 | - secretName: tls-secret 15 | rules: 16 | - host: spring.todo.coherence.community 17 | http: 18 | paths: 19 | - pathType: ImplementationSpecific 20 | backend: 21 | service: 22 | name: todo-list-http 23 | port: 24 | name: http 25 | --- 26 | apiVersion: networking.k8s.io/v1 27 | kind: Ingress 28 | metadata: 29 | name: grpc-ingress 30 | annotations: 31 | nginx.ingress.kubernetes.io/backend-protocol: "GRPC" 32 | spec: 33 | ingressClassName: nginx 34 | tls: 35 | - secretName: tls-secret 36 | rules: 37 | - host: grpc.spring.todo.coherence.community 38 | http: 39 | paths: 40 | - pathType: ImplementationSpecific 41 | backend: 42 | service: 43 | name: todo-list-grpc 44 | port: 45 | name: grpc 46 | --- 47 | apiVersion: networking.k8s.io/v1 48 | kind: Ingress 49 | metadata: 50 | name: jaeger-ingress 51 | spec: 52 | ingressClassName: nginx 53 | tls: 54 | - secretName: tls-secret 55 | rules: 56 | - host: jaeger.spring.todo.coherence.community 57 | http: 58 | paths: 59 | - pathType: ImplementationSpecific 60 | backend: 61 | service: 62 | name: jaeger-query 63 | port: 64 | name: http-query 65 | --- 66 | -------------------------------------------------------------------------------- /java/spring-server/src/main/java/com/oracle/coherence/examples/todo/server/graphql/TaskQueryController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, 2022, Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | package com.oracle.coherence.examples.todo.server.graphql; 8 | 9 | import com.oracle.coherence.examples.todo.server.model.Task; 10 | import com.oracle.coherence.examples.todo.server.service.TaskService; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.graphql.data.method.annotation.Argument; 13 | import org.springframework.graphql.data.method.annotation.QueryMapping; 14 | import org.springframework.stereotype.Controller; 15 | 16 | import java.util.Collection; 17 | 18 | /** 19 | * @author Gunnar Hillert 20 | */ 21 | @Controller 22 | public class TaskQueryController 23 | { 24 | 25 | @Autowired 26 | private TaskService taskService; 27 | 28 | /** 29 | * Find a single task by the provided id. 30 | * 31 | * @param id the id of the task to find 32 | * @return the retrieved task 33 | */ 34 | @QueryMapping 35 | public Task findTask(@Argument String id) 36 | { 37 | return taskService.find(id); 38 | } 39 | 40 | /** 41 | * Retrieve all tasks if completed is {@code false}. Otherwise, return only completed tasks. 42 | * @param completed if true return only completed tasks 43 | * @return a colection of tasks 44 | */ 45 | @QueryMapping 46 | public Collection tasks(@Argument boolean completed) 47 | { 48 | return taskService.findAll(completed); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /java/coherence-server/src/main/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | # ----------------------------------------------------------- 2 | # A Dockerfile to build a Coherence image that works out of 3 | # the box with the Coherence Kubernetes Operator. 4 | # 5 | # This image uses a distroless base image as this is more 6 | # secure than a base image that contains a full Linux O/S 7 | # distribution. 8 | # ----------------------------------------------------------- 9 | FROM gcr.io/distroless/java21-debian12 10 | 11 | # Configure the image's health check command 12 | # Health checks will only work with Coherence 22.06 and later 13 | HEALTHCHECK --start-period=10s --interval=30s \ 14 | CMD ["java", \ 15 | "-cp", "/app/libs/coherence.jar", \ 16 | "com.tangosol.util.HealthCheckClient", \ 17 | "http://127.0.0.1:6676/ready", \ 18 | "||", "exit", "1"] 19 | 20 | # Expose any default ports 21 | # The default Coherence gRPC port 22 | EXPOSE 1408 23 | # The default Coherence metrics port 24 | EXPOSE 9612 25 | 26 | # Set the entry point to be the Java command to run 27 | ENTRYPOINT ["java", "-cp", "/app/classes:/app/libs/*", "-Dcoherence.grpc.server.port=1408", "com.tangosol.net.Coherence"] 28 | 29 | # Set any environment variables 30 | # Use POF by default 31 | ENV COHERENCE_SERIALIZER=pof 32 | # Set the health check port to a fixed value (corresponding to the command above) 33 | ENV COHERENCE_HEALTH_HTTP_PORT=6676 34 | # Enable Coherence metics 35 | ENV COHERENCE_METRICS_HTTP_ENABLED=true 36 | # Set the Coherence log level to debug logging 37 | ENV COHERENCE_LOG_LEVEL=9 38 | 39 | # Copy all the application files into the /app directory in the image 40 | # This is the default structure supported by the Coherence Operator 41 | COPY app app 42 | 43 | 44 | -------------------------------------------------------------------------------- /java/helidon-client/src/main/java/com/oracle/coherence/examples/todo/client/TaskEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | package com.oracle.coherence.examples.todo.client; 9 | 10 | import java.lang.annotation.Annotation; 11 | import java.lang.annotation.Documented; 12 | import java.lang.annotation.Retention; 13 | import java.lang.annotation.RetentionPolicy; 14 | 15 | import jakarta.enterprise.util.AnnotationLiteral; 16 | import jakarta.inject.Qualifier; 17 | 18 | /** 19 | * Task event. 20 | * 21 | * @author Aleks Seovic 2020.07.28 22 | */ 23 | public abstract class TaskEvent 24 | { 25 | static Annotation INSERTED = new AnnotationLiteral() {}; 26 | static Annotation UPDATED = new AnnotationLiteral() {}; 27 | static Annotation REMOVED = new AnnotationLiteral() {}; 28 | 29 | // ---- event types ----------------------------------------------------- 30 | 31 | /** 32 | * A qualifier annotation used for TaskInserted event. 33 | */ 34 | @Qualifier 35 | @Documented 36 | @Retention(RetentionPolicy.RUNTIME) 37 | public @interface Inserted 38 | { 39 | } 40 | 41 | /** 42 | * A qualifier annotation used for TaskUpdated event. 43 | */ 44 | @Qualifier 45 | @Documented 46 | @Retention(RetentionPolicy.RUNTIME) 47 | public @interface Updated 48 | { 49 | } 50 | 51 | /** 52 | * A qualifier annotation used for TaskRemoved event. 53 | */ 54 | @Qualifier 55 | @Documented 56 | @Retention(RetentionPolicy.RUNTIME) 57 | public @interface Removed 58 | { 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /java/helidon-server/README.md: -------------------------------------------------------------------------------- 1 | # Coherence To Do List Example Application for Helidon 2 | 3 | ## Build Instructions 4 | 5 | 1. Build the Helidon Project 6 | 7 | Run the following from the project root directory at `helidon-server/` 8 | 9 | ```bash 10 | mvn clean install 11 | ``` 12 | 13 | ## Running the Example 14 | 15 | ### Run the server 16 | 17 | ```bash 18 | mvn exec:exec 19 | ``` 20 | 21 | ### Access the Web UI 22 | 23 | Access via http://localhost:7001/ 24 | 25 | ![To Do List - React Client](../../assets/react-client.png) 26 | 27 | ### Run the JavaFX Client 28 | 29 | ```bash 30 | cd ../client 31 | mvn javafx:run 32 | ``` 33 | 34 | ![To Do List - JavaFX Client](../../assets/javafx-client.png) 35 | 36 | ## Build and Run the Oracle JET UI (Optional) 37 | 38 | If you wish to run the Oracle JET UI, please carry out the following: 39 | 40 | 1. Install the JET CLI 41 | 42 | ```bash 43 | npm install -g @oracle/ojet-cli 44 | ``` 45 | 46 | 2. Build JET UI 47 | 48 | ```bash 49 | cd helidon-server/src/main/web/jet 50 | npm install 51 | ojet build 52 | ``` 53 | 54 | 3. Re-Build the Project 55 | 56 | Run the following from the project root directory: 57 | 58 | ```bash 59 | mvn clean install 60 | ``` 61 | 62 | 4. Access the Web UI 63 | 64 | Run the server as mentioned above and access the UI via http://localhost:7001/jet/ 65 | 66 | ![To Do List - Oracle JET Client](../../assets/jet-client.png) 67 | 68 | ## References 69 | 70 | * [Coherence Community Edition](https://github.com/oracle/coherence) 71 | * [Project Helidon](https://helidon.io/) 72 | * [Coherence Community Home Page](https://coherence.community/) 73 | * [Oracle JavaScript Extension Toolkit (JET)](https://www.oracle.com/webfolder/technetwork/jet/index.html) 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /java/spring-server/src/main/java/com/oracle/coherence/examples/todo/server/serializer/MessagePofSerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022, Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | package com.oracle.coherence.examples.todo.server.serializer; 8 | 9 | import com.google.protobuf.MessageLite; 10 | import com.google.protobuf.Parser; 11 | import com.tangosol.io.pof.PofReader; 12 | import com.tangosol.io.pof.PofSerializer; 13 | import com.tangosol.io.pof.PofWriter; 14 | import java.io.IOException; 15 | import java.lang.reflect.Method; 16 | 17 | /** 18 | * @author Aleks Seovic 2021.11.04 19 | * @author Gunnar Hillert 20 | */ 21 | public class MessagePofSerializer 22 | implements PofSerializer 23 | { 24 | public void serialize(PofWriter out, T msg) 25 | throws IOException 26 | { 27 | out.writeString(0, msg.getClass().getName()); 28 | out.writeByteArray(1, msg.toByteArray()); 29 | out.writeRemainder(null); 30 | } 31 | 32 | @SuppressWarnings("unchecked") 33 | public T deserialize(PofReader in) throws IOException 34 | { 35 | String sClassName = in.readString(0); 36 | byte[] abMsg = in.readByteArray(1); 37 | in.readRemainder(); 38 | 39 | try 40 | { 41 | Class clz = (Class) Class.forName(sClassName); 42 | Method methodParser = clz.getDeclaredMethod("parser"); 43 | Parser parser = (Parser) methodParser.invoke(clz); 44 | return parser.parseFrom(abMsg); 45 | } 46 | catch (Exception e) 47 | { 48 | throw new IOException(e); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /java/spring-server/src/test/java/com/oracle/coherence/examples/todo/server/BaseCoherenceMetricsTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | package com.oracle.coherence.examples.todo.server; 8 | 9 | import java.util.Collections; 10 | 11 | import org.junit.jupiter.api.MethodOrderer; 12 | import org.junit.jupiter.api.Order; 13 | import org.junit.jupiter.api.Test; 14 | import org.junit.jupiter.api.TestMethodOrder; 15 | 16 | import org.springframework.beans.factory.annotation.Autowired; 17 | import org.springframework.test.web.reactive.server.WebTestClient; 18 | 19 | /** 20 | * Base class for the Coherence Metrics tests. 21 | * 22 | * @author Gunnar Hillert 23 | * @see CoherenceMetricsDisabledTests 24 | * @see CoherenceMetricsEnabledTests 25 | */ 26 | @TestMethodOrder(MethodOrderer.OrderAnnotation.class) 27 | public abstract class BaseCoherenceMetricsTests { 28 | 29 | public static final int COHERENCE_METRICS_PORT = 9612; 30 | public static final String COHERENCE_METRICS_URL = "http://localhost:" + COHERENCE_METRICS_PORT + "/metrics"; 31 | public static final String TASKS_URL = "/api/tasks"; 32 | 33 | @Autowired 34 | protected WebTestClient webTestClient; 35 | 36 | @Test 37 | @Order(1) 38 | void addATask() { 39 | webTestClient.post() 40 | .uri(TASKS_URL) 41 | .bodyValue(Collections.singletonMap("description", "hello")) 42 | .exchange() 43 | .expectStatus().isOk(); 44 | } 45 | 46 | @Test 47 | @Order(2) 48 | void getAllTasks() { 49 | webTestClient.get() 50 | .uri(TASKS_URL) 51 | .exchange() 52 | .expectStatus().isOk() 53 | .expectBody().consumeWith(System.out::println) 54 | .jsonPath("$[0].description").isEqualTo("hello") 55 | .jsonPath("$[0].completed").isEqualTo(false); 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /bin/test-fat-jar.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Copyright (c) 2024, Oracle and/or its affiliates. 4 | # 5 | # Licensed under the Universal Permissive License v 1.0 as shown at 6 | # https://oss.oracle.com/licenses/upl. 7 | 8 | set -ex 9 | 10 | declare JAR="" 11 | declare JAR_PID="" 12 | declare CURL_PID="" 13 | 14 | function validate() { 15 | java -jar -Dotel.sdk.disabled=true "${JAR}" & 16 | JAR_PID=$! 17 | 18 | # give some time for the server to come up ... 19 | sleep 15 20 | 21 | # make a curl request to the SSE endpoint and capture the logs 22 | curl -N http://localhost:7001/api/tasks/events > log.txt 2>&1 & 23 | CURL_PID=$! 24 | 25 | # make a curl request to create a task 26 | curl -d '{"description": "Task1"}' -H 'Content-Type: application/json' -X POST http://localhost:7001/api/tasks 27 | 28 | # get the current tasks 29 | curl http://localhost:7001/api/tasks 30 | declare task_id=$(curl http://localhost:7001/api/tasks | grep -o '"id":"[^"]*' | grep -o '[^"]*$') 31 | 32 | # mark the task as completed 33 | curl -d '{"completed": "true"}' -H 'Content-Type: application/json' -X PUT http://localhost:7001/api/tasks/"${task_id}" 34 | 35 | # delete the task 36 | curl -X DELETE http://localhost:7001/api/tasks/"${task_id}" 37 | 38 | cat log.txt 39 | 40 | kill -3 $CURL_PID 41 | CURL_PID="" 42 | 43 | grep -e "event:\s*insert" log.txt 44 | grep -e "event:\s*insert" log.txt 45 | grep -e "event:\s*insert" log.txt 46 | } 47 | 48 | function cleanup() { 49 | if [ -n "${JAR_PID}" ]; then 50 | kill -9 ${JAR_PID} 51 | fi 52 | 53 | if [ -n "${CURL_PID}" ]; then 54 | kill -9 ${CURL_PID} 55 | fi 56 | } 57 | 58 | trap cleanup EXIT 59 | 60 | while getopts "d:" OPTION; do 61 | case "${OPTION}" in 62 | d) 63 | JAR=${OPTARG} 64 | validate 65 | ;; 66 | ?) 67 | echo "Usage: $(basename "$0") -d [fat-jar-to-test]" 68 | exit 1 69 | ;; 70 | esac 71 | done -------------------------------------------------------------------------------- /java/helidon-server/src/test/java/com/oracle/coherence/examples/todo/server/TodoListIT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | package com.oracle.coherence.examples.todo.server; 8 | 9 | import com.oracle.coherence.examples.todo.test.common.BaseTodoListTests; 10 | 11 | import io.helidon.microprofile.server.Server; 12 | 13 | import io.opentelemetry.api.GlobalOpenTelemetry; 14 | import org.junit.jupiter.api.AfterAll; 15 | import org.junit.jupiter.api.BeforeAll; 16 | 17 | public class TodoListIT 18 | extends BaseTodoListTests 19 | { 20 | @BeforeAll 21 | static void startServer() 22 | { 23 | GlobalOpenTelemetry.resetForTest(); 24 | System.setProperty("coherence.localhost", "127.0.0.1"); 25 | System.setProperty("coherence.ttl", "0"); 26 | System.setProperty("java.net.preferIPv4Stack", "true"); 27 | System.setProperty("coherence.wka", "127.0.0.1"); 28 | SERVER = Server.builder().port(0).build().start(); 29 | } 30 | 31 | @AfterAll 32 | static void stopServer() 33 | { 34 | if (SERVER != null) 35 | { 36 | SERVER.stop(); 37 | try 38 | { 39 | Thread.sleep(1000); 40 | } 41 | catch (InterruptedException e) 42 | { 43 | throw new RuntimeException(e); 44 | } 45 | } 46 | } 47 | 48 | // ----- helper methods ------------------------------------------------- 49 | 50 | protected String getUrl() 51 | { 52 | return "http://localhost:" + SERVER.port(); 53 | } 54 | 55 | // ----- data members --------------------------------------------------- 56 | 57 | protected static Server SERVER; 58 | } 59 | -------------------------------------------------------------------------------- /java/micronaut-server/README.md: -------------------------------------------------------------------------------- 1 | # Coherence To Do List Example Application for Micronaut 2 | 3 | ## Build Instructions 4 | 5 | ### Maven 6 | 7 | ```bash 8 | mvn clean package 9 | ``` 10 | 11 | ### Gradle 12 | 13 | ```bash 14 | ./gradlew clean build 15 | ``` 16 | 17 | ## Running the Example 18 | 19 | ### Maven 20 | 21 | ```bash 22 | java -jar target/todo-list-micronaut-server-24.03-shaded.jar 23 | ``` 24 | 25 | ## Building a Docker Image 26 | 27 | ### Maven 28 | 29 | ```bash 30 | mvn -P docker clean install 31 | ``` 32 | 33 | ### Running the Docker Container 34 | 35 | ```bash 36 | docker run -d -p 1408:1408 -p 7001:7001 -p 9612:9612 ghcr.io/coherence-community/todo-list-micronaut-server:latest 37 | ``` 38 | 39 | NOTE: `1408` is the default gRPC port, `3000` is the HTTP port, and `9612` is the metrics port. 40 | 41 | ### Access the Web UI 42 | 43 | Access via http://localhost:7001/ 44 | 45 | (NOTE: HTTP port will be 3000 if using the docker image) 46 | 47 | ![To Do List - React Client](../../assets/react-client.png) 48 | 49 | ### Run the JavaFX Client 50 | 51 | ```bash 52 | cd ../coherence-client 53 | mvn javafx:run 54 | ``` 55 | 56 | ![To Do List - JavaFX Client](../../assets/javafx-client.png) 57 | 58 | ### Query the GraphQL Endpoint 59 | 60 | The GraphQL Endpoint is available at: `http://localhost:7001/graphql`. Use one of the following tools to interact wih it: 61 | 62 | (NOTE: HTTP port will be 3000 if using the docker image) 63 | 64 | - [GraphQL](https://github.com/graphql/graphiql) 65 | - [Insomnia](https://insomnia.rest/download) 66 | 67 | For instance, retrieve a collection of tasks using the following query: 68 | 69 | ```graphql 70 | query { 71 | tasks(completed: false) { 72 | id 73 | description 74 | completed 75 | createdAt 76 | createdAtDate 77 | } 78 | } 79 | ``` 80 | 81 | For more information on GraphQL and using it with the To Do List example, [please see here](../graphql.md). 82 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2020, Oracle and/or its affiliates. 2 | 3 | The Universal Permissive License (UPL), Version 1.0 4 | 5 | Subject to the condition set forth below, permission is hereby granted to any 6 | person obtaining a copy of this software, associated documentation and/or data 7 | (collectively the "Software"), free of charge and under any and all copyright 8 | rights in the Software, and any and all patent rights owned or freely 9 | licensable by each licensor hereunder covering either (i) the unmodified 10 | Software as contributed to or provided by such licensor, or (ii) the Larger 11 | Works (as defined below), to deal in both 12 | 13 | (a) the Software, and 14 | (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if 15 | one is included with the Software (each a "Larger Work" to which the Software 16 | is contributed by such licensors), 17 | 18 | without restriction, including without limitation the rights to copy, create 19 | derivative works of, display, perform, and distribute the Software and make, 20 | use, sell, offer for sale, import, export, have made, and have sold the 21 | Software and the Larger Work(s), and to sublicense the foregoing rights on 22 | either these or other terms. 23 | 24 | This license is subject to the following condition: 25 | The above copyright notice and either this complete permission notice or at 26 | a minimum a reference to the UPL must be included in all copies or 27 | substantial portions of the Software. 28 | 29 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 35 | SOFTWARE. 36 | -------------------------------------------------------------------------------- /py/react-app/static/js/main.5fafe4e7.js.LICENSE.txt: -------------------------------------------------------------------------------- 1 | /* 2 | object-assign 3 | (c) Sindre Sorhus 4 | @license MIT 5 | */ 6 | 7 | /*! 8 | Copyright (c) 2018 Jed Watson. 9 | Licensed under the MIT License (MIT), see 10 | http://jedwatson.github.io/classnames 11 | */ 12 | 13 | /** @license React v0.19.1 14 | * scheduler.production.min.js 15 | * 16 | * Copyright (c) Facebook, Inc. and its affiliates. 17 | * 18 | * This source code is licensed under the MIT license found in the 19 | * LICENSE file in the root directory of this source tree. 20 | */ 21 | 22 | /** @license React v16.13.1 23 | * react-is.production.min.js 24 | * 25 | * Copyright (c) Facebook, Inc. and its affiliates. 26 | * 27 | * This source code is licensed under the MIT license found in the 28 | * LICENSE file in the root directory of this source tree. 29 | */ 30 | 31 | /** @license React v16.14.0 32 | * react-dom.production.min.js 33 | * 34 | * Copyright (c) Facebook, Inc. and its affiliates. 35 | * 36 | * This source code is licensed under the MIT license found in the 37 | * LICENSE file in the root directory of this source tree. 38 | */ 39 | 40 | /** @license React v16.14.0 41 | * react-jsx-runtime.production.min.js 42 | * 43 | * Copyright (c) Facebook, Inc. and its affiliates. 44 | * 45 | * This source code is licensed under the MIT license found in the 46 | * LICENSE file in the root directory of this source tree. 47 | */ 48 | 49 | /** @license React v16.14.0 50 | * react.production.min.js 51 | * 52 | * Copyright (c) Facebook, Inc. and its affiliates. 53 | * 54 | * This source code is licensed under the MIT license found in the 55 | * LICENSE file in the root directory of this source tree. 56 | */ 57 | 58 | /** @license React v17.0.2 59 | * react-is.production.min.js 60 | * 61 | * Copyright (c) Facebook, Inc. and its affiliates. 62 | * 63 | * This source code is licensed under the MIT license found in the 64 | * LICENSE file in the root directory of this source tree. 65 | */ 66 | -------------------------------------------------------------------------------- /java/spring-server/src/test/java/com/oracle/coherence/examples/todo/server/CoherenceMetricsEnabledTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | package com.oracle.coherence.examples.todo.server; 8 | 9 | import org.junit.jupiter.api.Order; 10 | import org.junit.jupiter.api.Test; 11 | 12 | import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient; 13 | import org.springframework.boot.test.context.SpringBootTest; 14 | import org.springframework.http.MediaType; 15 | import org.springframework.test.annotation.DirtiesContext; 16 | 17 | /** 18 | * Basic integration test to ensure Coherence metrics are properly exposed when 19 | * property {@code coherence.metrics.http.enabled} is set to {@code true}. 20 | * 21 | * @author Gunnar Hillert 22 | * @see CoherenceMetricsDisabledTests 23 | * @see BaseCoherenceMetricsTests 24 | */ 25 | @SpringBootTest( 26 | webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, 27 | properties = { 28 | "coherence.metrics.http.enabled=true" 29 | } 30 | ) 31 | @AutoConfigureWebTestClient 32 | @DirtiesContext 33 | public class CoherenceMetricsEnabledTests extends BaseCoherenceMetricsTests { 34 | 35 | @Test 36 | @Order(3) 37 | void ensureMetricsEndpointIsAvailable() { 38 | this.webTestClient.get() 39 | .uri(COHERENCE_METRICS_URL) 40 | .accept(MediaType.APPLICATION_JSON) 41 | .exchange() 42 | .expectStatus().isOk() 43 | .expectBody().consumeWith(System.out::println); 44 | } 45 | 46 | @Test 47 | @Order(4) 48 | void retrieveSpecificMetrics() { 49 | this.webTestClient.get() 50 | .uri(COHERENCE_METRICS_URL + "/Coherence.Cache.Size?name=tasks&tier=back") 51 | .accept(MediaType.APPLICATION_JSON) 52 | .exchange() 53 | .expectStatus().isOk() 54 | .expectBody().consumeWith(System.out::println) 55 | .jsonPath("$.length()").isEqualTo(1) 56 | .jsonPath("$[0].tags.name").isEqualTo("tasks") 57 | .jsonPath("$[0].value").isEqualTo(1); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /java/coherence-client/src/main/java/com/oracle/coherence/examples/todo/client/javafxcdi/ResourceBundleProducer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | package com.oracle.coherence.examples.todo.client.javafxcdi; 9 | 10 | /*- 11 | * #%L 12 | * Contexts and Dependency Injection for JavaFX 13 | * %% 14 | * Copyright (C) 2016 - 2018 Christoph Giesche 15 | * %% 16 | * Permission is hereby granted, free of charge, to any person obtaining a copy 17 | * of this software and associated documentation files (the "Software"), to deal 18 | * in the Software without restriction, including without limitation the rights 19 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 20 | * copies of the Software, and to permit persons to whom the Software is 21 | * furnished to do so, subject to the following conditions: 22 | * 23 | * The above copyright notice and this permission notice shall be included in 24 | * all copies or substantial portions of the Software. 25 | * 26 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 32 | * THE SOFTWARE. 33 | * #L% 34 | */ 35 | 36 | 37 | import java.util.ResourceBundle; 38 | import jakarta.enterprise.inject.Produces; 39 | import jakarta.enterprise.inject.spi.InjectionPoint; 40 | 41 | /** 42 | * @author Christoph Giesche 43 | */ 44 | public class ResourceBundleProducer { 45 | 46 | @Produces 47 | @Bundle("") 48 | public ResourceBundle produce(final InjectionPoint injectionPoint) { 49 | final String bundleName = injectionPoint.getAnnotated().getAnnotation(Bundle.class).value(); 50 | return ResourceBundle.getBundle(bundleName); 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /java/helidon-client/src/main/java/com/oracle/coherence/examples/todo/client/javafxcdi/ResourceBundleProducer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | package com.oracle.coherence.examples.todo.client.javafxcdi; 9 | 10 | /*- 11 | * #%L 12 | * Contexts and Dependency Injection for JavaFX 13 | * %% 14 | * Copyright (C) 2016 - 2018 Christoph Giesche 15 | * %% 16 | * Permission is hereby granted, free of charge, to any person obtaining a copy 17 | * of this software and associated documentation files (the "Software"), to deal 18 | * in the Software without restriction, including without limitation the rights 19 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 20 | * copies of the Software, and to permit persons to whom the Software is 21 | * furnished to do so, subject to the following conditions: 22 | * 23 | * The above copyright notice and this permission notice shall be included in 24 | * all copies or substantial portions of the Software. 25 | * 26 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 32 | * THE SOFTWARE. 33 | * #L% 34 | */ 35 | 36 | 37 | import jakarta.enterprise.inject.Produces; 38 | import jakarta.enterprise.inject.spi.InjectionPoint; 39 | import java.util.ResourceBundle; 40 | 41 | /** 42 | * @author Christoph Giesche 43 | */ 44 | public class ResourceBundleProducer { 45 | 46 | @Produces 47 | @Bundle("") 48 | public ResourceBundle produce(final InjectionPoint injectionPoint) { 49 | final String bundleName = injectionPoint.getAnnotated().getAnnotation(Bundle.class).value(); 50 | return ResourceBundle.getBundle(bundleName); 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /js/src/components/TodoItem.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | import React, { Component } from 'react' 9 | import PropTypes from 'prop-types' 10 | import classnames from 'classnames' 11 | import TodoTextInput from './TodoTextInput' 12 | 13 | export default class TodoItem extends Component { 14 | static propTypes = { 15 | todo: PropTypes.object.isRequired, 16 | updateTodoRequest: PropTypes.func.isRequired, 17 | deleteTodoRequest: PropTypes.func.isRequired, 18 | toggleTodoRequest: PropTypes.func.isRequired 19 | }; 20 | 21 | state = { 22 | editing: false 23 | }; 24 | 25 | handleDoubleClick = () => { 26 | this.setState({editing: true}) 27 | }; 28 | 29 | handleSave = (id, text) => { 30 | if (text.length === 0) { 31 | this.props.deleteTodoRequest(id) 32 | } 33 | else { 34 | this.props.updateTodoRequest(id, text) 35 | } 36 | this.setState({editing: false}) 37 | }; 38 | 39 | render() { 40 | const { todo, toggleTodoRequest, deleteTodoRequest } = this.props; 41 | 42 | let element; 43 | if (this.state.editing) { 44 | element = ( 45 | this.handleSave(todo.id, text)}/> 48 | ) 49 | } 50 | else { 51 | element = ( 52 |
53 | toggleTodoRequest(todo.id, !todo.completed)}/> 57 | 60 |
63 | ) 64 | } 65 | 66 | return ( 67 |
  • 71 | {element} 72 |
  • 73 | ) 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /java/coherence-client/src/test/java/com/oracle/coherence/examples/todo/client/SystemPropertyExtension.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2000, 2022, Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | package com.oracle.coherence.examples.todo.client; 8 | 9 | import org.junit.jupiter.api.extension.BeforeAllCallback; 10 | import org.junit.jupiter.api.extension.ExtensionContext; 11 | 12 | import java.util.HashMap; 13 | import java.util.Map; 14 | import java.util.function.Supplier; 15 | 16 | /** 17 | * A JUnit 5 extension that sets System properties in the 18 | * {@link BeforeAllCallback before all phase}. 19 | *

    20 | * By using this extension with {@link org.junit.jupiter.api.Order @Order} 21 | * after other extensions, it is possible to configures properties based on 22 | * the state of other extensions before tests run. 23 | * 24 | * @author Jonathan Knight 2022.06.20 25 | * @since 22.06 26 | */ 27 | public class SystemPropertyExtension 28 | implements BeforeAllCallback 29 | { 30 | @Override 31 | public void beforeAll(ExtensionContext context) 32 | { 33 | properties.forEach((k, v) -> 34 | { 35 | Object o = v.get(); 36 | if (o != null) 37 | { 38 | System.setProperty(k, String.valueOf(o)); 39 | } 40 | }); 41 | } 42 | 43 | /** 44 | * Add a property to set. 45 | *

    46 | * The {@code toString()} of the value returned by the supplier will be used 47 | * as the property value. 48 | *

    49 | * If the {@link Supplier} returns {@code null} then no property will be set. 50 | * 51 | * @param key the key of the property 52 | * @param value a supplier for the property value 53 | * 54 | * @return this builder 55 | */ 56 | public SystemPropertyExtension withProperty(String key, Supplier value) 57 | { 58 | properties.put(key, value); 59 | return this; 60 | } 61 | 62 | /** 63 | * The {@link Map} of properties to set. 64 | */ 65 | private final Map> properties = new HashMap<>(); 66 | } 67 | -------------------------------------------------------------------------------- /java/helidon-server/src/main/web/react/src/components/TodoItem.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | import React, { Component } from 'react' 9 | import PropTypes from 'prop-types' 10 | import classnames from 'classnames' 11 | import TodoTextInput from './TodoTextInput' 12 | 13 | export default class TodoItem extends Component { 14 | static propTypes = { 15 | todo: PropTypes.object.isRequired, 16 | updateTodoRequest: PropTypes.func.isRequired, 17 | deleteTodoRequest: PropTypes.func.isRequired, 18 | toggleTodoRequest: PropTypes.func.isRequired 19 | }; 20 | 21 | state = { 22 | editing: false 23 | }; 24 | 25 | handleDoubleClick = () => { 26 | this.setState({editing: true}) 27 | }; 28 | 29 | handleSave = (id, text) => { 30 | if (text.length === 0) { 31 | this.props.deleteTodoRequest(id) 32 | } 33 | else { 34 | this.props.updateTodoRequest(id, text) 35 | } 36 | this.setState({editing: false}) 37 | }; 38 | 39 | render() { 40 | const { todo, toggleTodoRequest, deleteTodoRequest } = this.props; 41 | 42 | let element; 43 | if (this.state.editing) { 44 | element = ( 45 | this.handleSave(todo.id, text)}/> 48 | ) 49 | } 50 | else { 51 | element = ( 52 |

    53 | toggleTodoRequest(todo.id, !todo.completed)}/> 57 | 60 |
    63 | ) 64 | } 65 | 66 | return ( 67 |
  • 71 | {element} 72 |
  • 73 | ) 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /java/micronaut-server/src/main/web/react/src/components/TodoItem.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | import React, { Component } from 'react' 9 | import PropTypes from 'prop-types' 10 | import classnames from 'classnames' 11 | import TodoTextInput from './TodoTextInput' 12 | 13 | export default class TodoItem extends Component { 14 | static propTypes = { 15 | todo: PropTypes.object.isRequired, 16 | updateTodoRequest: PropTypes.func.isRequired, 17 | deleteTodoRequest: PropTypes.func.isRequired, 18 | toggleTodoRequest: PropTypes.func.isRequired 19 | }; 20 | 21 | state = { 22 | editing: false 23 | }; 24 | 25 | handleDoubleClick = () => { 26 | this.setState({editing: true}) 27 | }; 28 | 29 | handleSave = (id, text) => { 30 | if (text.length === 0) { 31 | this.props.deleteTodoRequest(id) 32 | } 33 | else { 34 | this.props.updateTodoRequest(id, text) 35 | } 36 | this.setState({editing: false}) 37 | }; 38 | 39 | render() { 40 | const { todo, toggleTodoRequest, deleteTodoRequest } = this.props; 41 | 42 | let element; 43 | if (this.state.editing) { 44 | element = ( 45 | this.handleSave(todo.id, text)}/> 48 | ) 49 | } 50 | else { 51 | element = ( 52 |
    53 | toggleTodoRequest(todo.id, !todo.completed)}/> 57 | 60 |
    63 | ) 64 | } 65 | 66 | return ( 67 |
  • 71 | {element} 72 |
  • 73 | ) 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /java/spring-server/src/main/web/react/src/components/TodoItem.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | import React, { Component } from 'react' 9 | import PropTypes from 'prop-types' 10 | import classnames from 'classnames' 11 | import TodoTextInput from './TodoTextInput' 12 | 13 | export default class TodoItem extends Component { 14 | static propTypes = { 15 | todo: PropTypes.object.isRequired, 16 | updateTodoRequest: PropTypes.func.isRequired, 17 | deleteTodoRequest: PropTypes.func.isRequired, 18 | toggleTodoRequest: PropTypes.func.isRequired 19 | }; 20 | 21 | state = { 22 | editing: false 23 | }; 24 | 25 | handleDoubleClick = () => { 26 | this.setState({editing: true}) 27 | }; 28 | 29 | handleSave = (id, text) => { 30 | if (text.length === 0) { 31 | this.props.deleteTodoRequest(id) 32 | } 33 | else { 34 | this.props.updateTodoRequest(id, text) 35 | } 36 | this.setState({editing: false}) 37 | }; 38 | 39 | render() { 40 | const { todo, toggleTodoRequest, deleteTodoRequest } = this.props; 41 | 42 | let element; 43 | if (this.state.editing) { 44 | element = ( 45 | this.handleSave(todo.id, text)}/> 48 | ) 49 | } 50 | else { 51 | element = ( 52 |
    53 | toggleTodoRequest(todo.id, !todo.completed)}/> 57 | 60 |
    63 | ) 64 | } 65 | 66 | return ( 67 |
  • 71 | {element} 72 |
  • 73 | ) 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /java/helidon-server/src/main/web/jet/src/css/images/oracle_logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 21 | 22 | -------------------------------------------------------------------------------- /js/src/components/MainSection.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Oracle and/or its affiliates. 3 | * 4 | * Licensed under the Universal Permissive License v 1.0 as shown at 5 | * https://oss.oracle.com/licenses/upl. 6 | */ 7 | 8 | import React, { Component } from 'react' 9 | import PropTypes from 'prop-types' 10 | import TodoItem from './TodoItem' 11 | import Footer from './Footer' 12 | import { SHOW_ALL, SHOW_COMPLETED, SHOW_ACTIVE } from '../constants/TodoFilters' 13 | 14 | const TODO_FILTERS = { 15 | [SHOW_ALL]: () => true, 16 | [SHOW_ACTIVE]: todo => !todo.completed, 17 | [SHOW_COMPLETED]: todo => todo.completed 18 | }; 19 | 20 | class MainSection extends Component { 21 | static propTypes = { 22 | todos: PropTypes.array.isRequired, 23 | actions: PropTypes.object.isRequired 24 | }; 25 | 26 | state = {filter: SHOW_ALL}; 27 | 28 | handleClearCompleted = () => { 29 | this.props.actions.clearCompletedRequest() 30 | }; 31 | 32 | handleShow = filter => { 33 | this.setState({filter}) 34 | }; 35 | 36 | renderFooter(completedCount) { 37 | const { todos } = this.props; 38 | const { filter } = this.state; 39 | const activeCount = todos.length - completedCount; 40 | 41 | if (todos.length) { 42 | return ( 43 |