Compare commits
14 Commits
l10n_maste
...
fix-claim-
Author | SHA1 | Date | |
---|---|---|---|
fcf3e5265e | |||
5d78a77b97 | |||
9063336687 | |||
b22c8bc32f | |||
f7fc48d6b7 | |||
414e3263b1 | |||
2674cb9523 | |||
925755fa35 | |||
89b2072131 | |||
0a7b524bd1 | |||
36c6ce1df7 | |||
22ddd57146 | |||
72bb189dc0 | |||
bee1283371 |
@ -1712,6 +1712,43 @@
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "harshalkh",
|
||||
"name": "Harshal",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/37841724?v=4",
|
||||
"profile": "https://github.com/harshalkh",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "vashisthabhinav",
|
||||
"name": "Abhinav Vashisth",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/89785800?v=4",
|
||||
"profile": "https://www.linkedin.com/in/abhinav-vashisth-06613b208/",
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "Kevinyl3",
|
||||
"name": "Kevin",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/47126749?v=4",
|
||||
"profile": "http://no website",
|
||||
"contributions": [
|
||||
"review"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "Shrirang97",
|
||||
"name": "Shrirang",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/28738668?v=4",
|
||||
"profile": "https://github.com/Shrirang97",
|
||||
"contributions": [
|
||||
"review",
|
||||
"code"
|
||||
]
|
||||
}
|
||||
],
|
||||
"contributorsPerLine": 7,
|
||||
|
49
.github/workflows/maven-ci.yml
vendored
49
.github/workflows/maven-ci.yml
vendored
@ -24,6 +24,9 @@
|
||||
# This workflow will build a Java project with Maven
|
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
|
||||
|
||||
# We are using two jobs here for testing our code on the latest JDK 11 build as well as a more satble build version of 11.0.3
|
||||
# You can see the full discussion here https://github.com/iluwatar/java-design-patterns/pull/1868#issue-1029459688
|
||||
|
||||
name: Java CI
|
||||
|
||||
on:
|
||||
@ -33,12 +36,11 @@ on:
|
||||
|
||||
jobs:
|
||||
|
||||
build:
|
||||
# This Workflow Job will build this project and run Sonar analysis using JDK 11.0.3
|
||||
build-and-analyze:
|
||||
|
||||
name: Build and Run Sonar analysis on JDK 11.0.3
|
||||
runs-on: ubuntu-20.04
|
||||
strategy:
|
||||
matrix:
|
||||
java-version: [ 11.0.3, 11 ]
|
||||
steps:
|
||||
|
||||
- name: Checkout Code
|
||||
@ -47,12 +49,14 @@ jobs:
|
||||
# Disabling shallow clone for improving relevancy of SonarQube reporting
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up JDK ${{ matrix.java-version }}
|
||||
- name: Set up JDK 11.0.3
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
java-version: ${{ matrix.java-version }}
|
||||
java-version: 11.0.3
|
||||
distribution: 'zulu'
|
||||
cache: 'maven'
|
||||
|
||||
# Cache Sonar packages which as used to run anaylysis and collect metrics
|
||||
- name: Cache SonarCloud packages
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
@ -60,14 +64,6 @@ jobs:
|
||||
key: ${{ runner.os }}-sonar
|
||||
restore-keys: ${{ runner.os }}-sonar
|
||||
|
||||
- name: Cache Maven dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.m2/repository
|
||||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-maven-
|
||||
|
||||
# Some tests need screen access
|
||||
- name: Install xvfb
|
||||
run: sudo apt-get install -y xvfb
|
||||
@ -78,3 +74,28 @@ jobs:
|
||||
# These two env variables are needed for sonar analysis
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||
|
||||
|
||||
# This Workflow Job is going to build the project on the latest stable JDK 11
|
||||
build:
|
||||
|
||||
name: Build and Test on JDK 11
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set up JDK 11 (Latest)
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
java-version: 11
|
||||
distribution: 'zulu'
|
||||
cache: 'maven'
|
||||
|
||||
# Some tests need screen access
|
||||
- name: Install xvfb
|
||||
run: sudo apt-get install -y xvfb
|
||||
|
||||
- name: Build with Maven
|
||||
run: xvfb-run ./mvnw clean verify
|
||||
|
11
.github/workflows/maven-pr-builder.yml
vendored
11
.github/workflows/maven-pr-builder.yml
vendored
@ -34,11 +34,13 @@ on:
|
||||
jobs:
|
||||
build:
|
||||
|
||||
name: Build JDP
|
||||
runs-on: ubuntu-20.04
|
||||
strategy:
|
||||
matrix:
|
||||
java-version: [ 11.0.3, 11 ]
|
||||
steps:
|
||||
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
@ -47,14 +49,7 @@ jobs:
|
||||
with:
|
||||
java-version: ${{ matrix.java-version }}
|
||||
distribution: 'zulu'
|
||||
|
||||
- name: Cache Maven Dependecies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.m2/repository
|
||||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-maven-
|
||||
cache: 'maven'
|
||||
|
||||
# Some tests need screen access
|
||||
- name: Install xvfb
|
||||
|
22
README.md
22
README.md
@ -10,7 +10,7 @@
|
||||
[](https://sonarcloud.io/dashboard?id=iluwatar_java-design-patterns)
|
||||
[](https://gitter.im/iluwatar/java-design-patterns?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
||||
[](#contributors-)
|
||||
[](#contributors-)
|
||||
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
||||
|
||||
<br/>
|
||||
@ -21,7 +21,7 @@ Read in different language : [**zh**](localization/zh/README.md), [**ko**](local
|
||||
|
||||
# Introduction
|
||||
|
||||
Design patterns are the best formalized practices a programmer can use to
|
||||
Design patterns are the best, formalized practices a programmer can use to
|
||||
solve common problems when designing an application or system.
|
||||
|
||||
Design patterns can speed up the development process by providing tested, proven
|
||||
@ -34,11 +34,11 @@ are familiar with the patterns.
|
||||
# Getting started
|
||||
|
||||
This site showcases Java Design Patterns. The solutions have been developed by
|
||||
experienced programmers and architects from the open source community. The
|
||||
patterns can be browsed by their high level descriptions or by looking at their
|
||||
source code. The source code examples are well commented and can be thought as
|
||||
experienced programmers and architects from the open-source community. The
|
||||
patterns can be browsed by their high-level descriptions or by looking at their
|
||||
source code. The source code examples are well commented and can be thought of as
|
||||
programming tutorials on how to implement a specific pattern. We use the most
|
||||
popular battle-proven open source Java technologies.
|
||||
popular battle-proven open-source Java technologies.
|
||||
|
||||
Before you dive into the material, you should be familiar with various
|
||||
[Software Design Principles](https://java-design-patterns.com/principles/).
|
||||
@ -56,8 +56,8 @@ of the following approaches
|
||||
- Using tags such as `Performance`, `Gang of Four` or `Data access`.
|
||||
- Using pattern categories, `Creational`, `Behavioral`, and others.
|
||||
|
||||
Hopefully you find the object oriented solutions presented on this site useful
|
||||
in your architectures and have as much fun learning them as we had developing them.
|
||||
Hopefully, you find the object-oriented solutions presented on this site useful
|
||||
in your architectures and have as much fun learning them as we had while developing them.
|
||||
|
||||
# How to contribute
|
||||
|
||||
@ -316,6 +316,12 @@ This project is licensed under the terms of the MIT license.
|
||||
<td align="center"><a href="https://github.com/blueberry404"><img src="https://avatars.githubusercontent.com/u/39243539?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Anum Amin</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=blueberry404" title="Documentation">📖</a></td>
|
||||
<td align="center"><a href="https://uh-zz.github.io/blog/"><img src="https://avatars.githubusercontent.com/u/47747828?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Reo Uehara</b></sub></a><br /><a href="#translation-uh-zz" title="Translation">🌍</a></td>
|
||||
<td align="center"><a href="https://github.com/Fiordy"><img src="https://avatars.githubusercontent.com/u/53420573?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Fiordy</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=Fiordy" title="Documentation">📖</a></td>
|
||||
<td align="center"><a href="https://github.com/harshalkh"><img src="https://avatars.githubusercontent.com/u/37841724?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Harshal</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=harshalkh" title="Code">💻</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><a href="https://www.linkedin.com/in/abhinav-vashisth-06613b208/"><img src="https://avatars.githubusercontent.com/u/89785800?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Abhinav Vashisth</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=vashisthabhinav" title="Documentation">📖</a></td>
|
||||
<td align="center"><a href="http://no website"><img src="https://avatars.githubusercontent.com/u/47126749?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Kevin</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/pulls?q=is%3Apr+reviewed-by%3AKevinyl3" title="Reviewed Pull Requests">👀</a></td>
|
||||
<td align="center"><a href="https://github.com/Shrirang97"><img src="https://avatars.githubusercontent.com/u/28738668?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Shrirang</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/pulls?q=is%3Apr+reviewed-by%3AShrirang97" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/iluwatar/java-design-patterns/commits?author=Shrirang97" title="Code">💻</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
<parent>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>abstract-document</artifactId>
|
||||
<dependencies>
|
||||
|
@ -28,7 +28,7 @@
|
||||
<parent>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>abstract-factory</artifactId>
|
||||
<dependencies>
|
||||
|
@ -28,7 +28,7 @@
|
||||
<parent>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>active-object</artifactId>
|
||||
<dependencies>
|
||||
|
@ -28,7 +28,7 @@
|
||||
<parent>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>acyclic-visitor</artifactId>
|
||||
<properties>
|
||||
|
@ -28,7 +28,7 @@
|
||||
<parent>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>adapter</artifactId>
|
||||
<dependencies>
|
||||
|
@ -27,7 +27,7 @@
|
||||
<parent>
|
||||
<artifactId>aggregator-microservices</artifactId>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>aggregator-service</artifactId>
|
||||
|
@ -27,7 +27,7 @@
|
||||
<parent>
|
||||
<artifactId>aggregator-microservices</artifactId>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>information-microservice</artifactId>
|
||||
|
@ -27,7 +27,7 @@
|
||||
<parent>
|
||||
<artifactId>aggregator-microservices</artifactId>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>inventory-microservice</artifactId>
|
||||
|
@ -27,7 +27,7 @@
|
||||
<parent>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>aggregator-microservices</artifactId>
|
||||
|
@ -27,7 +27,7 @@
|
||||
<parent>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>ambassador</artifactId>
|
||||
|
@ -27,7 +27,7 @@
|
||||
<parent>
|
||||
<artifactId>api-gateway</artifactId>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>api-gateway-service</artifactId>
|
||||
|
@ -27,7 +27,7 @@
|
||||
<parent>
|
||||
<artifactId>api-gateway</artifactId>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>image-microservice</artifactId>
|
||||
|
@ -27,7 +27,7 @@
|
||||
<parent>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>api-gateway</artifactId>
|
||||
|
@ -27,7 +27,7 @@
|
||||
<parent>
|
||||
<artifactId>api-gateway</artifactId>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>price-microservice</artifactId>
|
||||
|
@ -27,7 +27,7 @@
|
||||
<parent>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>arrange-act-assert</artifactId>
|
||||
|
@ -28,7 +28,7 @@
|
||||
<parent>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>async-method-invocation</artifactId>
|
||||
<dependencies>
|
||||
|
@ -27,7 +27,7 @@
|
||||
<parent>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>balking</artifactId>
|
||||
|
@ -28,7 +28,7 @@
|
||||
<parent>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>bridge</artifactId>
|
||||
<dependencies>
|
||||
|
@ -28,7 +28,7 @@
|
||||
<parent>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>builder</artifactId>
|
||||
<dependencies>
|
||||
|
@ -28,7 +28,7 @@
|
||||
<parent>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>business-delegate</artifactId>
|
||||
<dependencies>
|
||||
|
@ -27,7 +27,7 @@
|
||||
<parent>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>bytecode</artifactId>
|
||||
|
@ -28,7 +28,7 @@
|
||||
<parent>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>caching</artifactId>
|
||||
<dependencies>
|
||||
|
@ -28,7 +28,7 @@
|
||||
<parent>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>callback</artifactId>
|
||||
<dependencies>
|
||||
|
@ -28,7 +28,7 @@
|
||||
<parent>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>chain-of-responsibility</artifactId>
|
||||
<dependencies>
|
||||
|
@ -28,7 +28,7 @@
|
||||
<parent>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>circuit-breaker</artifactId>
|
||||
<dependencies>
|
||||
|
38
cloud-claim-check-pattern/.gitignore
vendored
Normal file
38
cloud-claim-check-pattern/.gitignore
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
# Build output
|
||||
target/
|
||||
*.class
|
||||
|
||||
# Log file
|
||||
*.log
|
||||
|
||||
# BlueJ files
|
||||
*.ctxt
|
||||
|
||||
# Mobile Tools for Java (J2ME)
|
||||
.mtj.tmp/
|
||||
|
||||
# Package Files #
|
||||
*.jar
|
||||
*.war
|
||||
*.ear
|
||||
*.zip
|
||||
*.tar.gz
|
||||
*.rar
|
||||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
|
||||
# IDE
|
||||
.idea/
|
||||
*.iml
|
||||
.settings/
|
||||
.project
|
||||
.classpath
|
||||
|
||||
# macOS
|
||||
.DS_Store
|
||||
|
||||
# Azure Functions
|
||||
local.settings.json
|
||||
bin/
|
||||
obj/
|
83
cloud-claim-check-pattern/README.md
Normal file
83
cloud-claim-check-pattern/README.md
Normal file
@ -0,0 +1,83 @@
|
||||
---
|
||||
layout: pattern
|
||||
title: Claim Check Pattern
|
||||
folder: cloud-claim-check-pattern
|
||||
permalink: /patterns/cloud-claim-check-pattern/
|
||||
categories: Cloud
|
||||
language: en
|
||||
tags:
|
||||
- Cloud distributed
|
||||
- Microservices
|
||||
---
|
||||
|
||||
## Name
|
||||
|
||||
[Claim Check Pattern](https://docs.microsoft.com/en-us/azure/architecture/patterns/claim-check)
|
||||
|
||||
## Also known as
|
||||
|
||||
[Reference-Based Messaging](https://www.enterpriseintegrationpatterns.com/patterns/messaging/StoreInLibrary.html)
|
||||
|
||||
## Intent
|
||||
|
||||
- Reduce the load of data transfer through the Internet. Instead of sending actual data directly, just send the message reference.
|
||||
- Improve data security. As only message reference is shared, no data is exposed to the Internet.
|
||||
|
||||
## Explanation
|
||||
|
||||
Real-World Example
|
||||
|
||||
> Suppose if you want to build a photo processing system. A photo processing system takes an image as input, processes it, and outputs a different set of images. Consider system has one persistent storage, one input component, ten processing components, messaging platform. Once a photo is given to the input component, it stores that image on persistent storage. It then creates ten different messages/events with the same image location and publishes them to the messaging platform. The messaging platform triggers ten different processing components. The ten processing components extract information about image location from the received event and then read an image from persistent storage. They generate ten different images from the original image and drop these images again to persistent storage.
|
||||
|
||||
In Plain words
|
||||
|
||||
> Split a large message into a claim check and a payload. Send the claim check to the messaging platform and store the payload to an external service. This pattern allows large messages to be processed while protecting the message bus and the client from being overwhelmed or slowed down. This pattern also helps to reduce costs, as storage is usually cheaper than resource units used by the messaging platform.([ref](https://docs.microsoft.com/en-us/azure/architecture/patterns/claim-check))
|
||||
|
||||
## Architecture Diagram
|
||||
|
||||

|
||||
|
||||
## Applicability
|
||||
|
||||
Use the Claim Check Pattern when
|
||||
|
||||
- Huge processing data causes a lot of bandwidth consumption to transfer data through the Internet.
|
||||
- To secure your data transfer by storing in common persistent storage.
|
||||
- Using a cloud platform - Azure Functions or AWS Lambda, Azure EventGrid or AWS Event Bridge, Azure Blob Storage or AWS S3 Bucket.
|
||||
- Each service must be independent and idempotent. Output data is dropped to persistent storage by the service.
|
||||
- Publish-subscribe messaging pattern needs to be used.
|
||||
|
||||
## Consequences
|
||||
|
||||
- This pattern is stateless. Any compute API will not store any data.
|
||||
- You must have persistent storage and a reliable messaging platform.
|
||||
|
||||
## Tutorials
|
||||
|
||||
### Workflow
|
||||
|
||||
Suppose a telecom company wants to build call cost calculator system which generate the call cost daily. At the end of each day, details of the calls made by the consumers are stored somewhere. The call calculator system will read this data and generate call cost data for each user. Consumers will be billed using this generated data in case of postpaid service.
|
||||
|
||||
Producer class( `UsageDetailPublisherFunction` Azure Function) will generate call usage details (here we are generating call data in producer class itself. In real world scenario, it will read from storage). `UsageDetailPublisherFunction` creates a message. Message consists of message header and message body. Message header is basically an event grid event or claim or message reference. Message body contains actual data. `UsageDetailPublisherFunction` sends a message header to Event Grid topic `usage-detail` and drops an entire message to the blob storage. Event Grid then sent this message header to the `UsageCostProcessorFunction` Azure function. It will read the entire message from blob storage with the help of the header, will calculate call cost and drop the result to the blob storage.
|
||||
|
||||
### Class Diagrams
|
||||
|
||||

|
||||
|
||||
### Setup
|
||||
|
||||
- Any operating system can be used macOS, Windows, Linux as everything is deployed on Azure.
|
||||
- Install Java JDK 11 and set up Java environmental variables.
|
||||
- Install Git.
|
||||
- Install Visual Studio Code.
|
||||
- Install [ Azure Functions extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurefunctions) to be able to deploy using Visual studio.
|
||||
|
||||
### Storage Data
|
||||
|
||||
The data is stored in the Azure blob storage in the container `callusageapp`. For every trigger, one GUID is created. Under the `GUID folder`, 2 files will be created `input.json` and `output.json`.
|
||||
`Input.json` is dropped `producer` azure function which contains call usage details.` Output.json` contains call cost details which are dropped by the `consumer` azure function.
|
||||
|
||||
## Credits
|
||||
|
||||
- [Messaging Pattern - Claim Check](https://www.enterpriseintegrationpatterns.com/patterns/messaging/StoreInLibrary.html)
|
||||
- [Azure Architecture Pattern - Claim Check Pattern](https://docs.microsoft.com/en-us/azure/architecture/patterns/claim-check)
|
38
cloud-claim-check-pattern/call-usage-app/.gitignore
vendored
Normal file
38
cloud-claim-check-pattern/call-usage-app/.gitignore
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
# Build output
|
||||
target/
|
||||
*.class
|
||||
|
||||
# Log file
|
||||
*.log
|
||||
|
||||
# BlueJ files
|
||||
*.ctxt
|
||||
|
||||
# Mobile Tools for Java (J2ME)
|
||||
.mtj.tmp/
|
||||
|
||||
# Package Files #
|
||||
*.jar
|
||||
*.war
|
||||
*.ear
|
||||
*.zip
|
||||
*.tar.gz
|
||||
*.rar
|
||||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
|
||||
# IDE
|
||||
.idea/
|
||||
*.iml
|
||||
.settings/
|
||||
.project
|
||||
.classpath
|
||||
|
||||
# macOS
|
||||
.DS_Store
|
||||
|
||||
# Azure Functions
|
||||
local.settings.json
|
||||
bin/
|
||||
obj/
|
@ -0,0 +1,117 @@
|
||||
@startuml
|
||||
package com.iluwatar.claimcheckpattern.producer.calldetails.functions {
|
||||
class UsageDetailPublisherFunction {
|
||||
- eventHandlerUtility : EventHandlerUtility<MessageHeader>
|
||||
- messageHandlerUtility : MessageHandlerUtility<UsageDetail>
|
||||
+ UsageDetailPublisherFunction()
|
||||
+ UsageDetailPublisherFunction(messageHandlerUtility : MessageHandlerUtility<UsageDetail>, eventHandlerUtility : EventHandlerUtility<MessageHeader>)
|
||||
+ run(request : HttpRequestMessage<Optional<String>>, context : ExecutionContext) : HttpResponseMessage
|
||||
}
|
||||
}
|
||||
package com.iluwatar.claimcheckpattern.domain {
|
||||
class Message<T> {
|
||||
- messageBody : MessageBody<T>
|
||||
- messageHeader : MessageHeader
|
||||
+ Message<T>()
|
||||
+ getMessageBody() : MessageBody<T>
|
||||
+ getMessageHeader() : MessageHeader
|
||||
+ setMessageBody(messageBody : MessageBody<T>)
|
||||
+ setMessageHeader(messageHeader : MessageHeader)
|
||||
}
|
||||
class MessageBody<T> {
|
||||
- data : List<T>
|
||||
+ MessageBody<T>()
|
||||
+ getData() : List<T>
|
||||
+ setData(data : List<T>)
|
||||
}
|
||||
class MessageHeader {
|
||||
- data : Object
|
||||
- dataVersion : String
|
||||
- eventTime : String
|
||||
- eventType : String
|
||||
- id : String
|
||||
- subject : String
|
||||
- topic : String
|
||||
+ MessageHeader()
|
||||
+ getData() : Object
|
||||
+ getDataVersion() : String
|
||||
+ getEventTime() : String
|
||||
+ getEventType() : String
|
||||
+ getId() : String
|
||||
+ getSubject() : String
|
||||
+ getTopic() : String
|
||||
+ setData(data : Object)
|
||||
+ setDataVersion(dataVersion : String)
|
||||
+ setEventTime(eventTime : String)
|
||||
+ setEventType(eventType : String)
|
||||
+ setId(id : String)
|
||||
+ setSubject(subject : String)
|
||||
+ setTopic(topic : String)
|
||||
}
|
||||
class MessageReference {
|
||||
- dataFileName : String
|
||||
- dataLocation : String
|
||||
+ MessageReference()
|
||||
+ MessageReference(dataLocation : String, dataFileName : String)
|
||||
+ getDataFileName() : String
|
||||
+ getDataLocation() : String
|
||||
+ setDataFileName(dataFileName : String)
|
||||
+ setDataLocation(dataLocation : String)
|
||||
}
|
||||
class UsageCostDetail {
|
||||
- callCost : double
|
||||
- dataCost : double
|
||||
- userId : String
|
||||
+ UsageCostDetail()
|
||||
+ getCallCost() : double
|
||||
+ getDataCost() : double
|
||||
+ getUserId() : String
|
||||
+ setCallCost(callCost : double)
|
||||
+ setDataCost(dataCost : double)
|
||||
+ setUserId(userId : String)
|
||||
}
|
||||
class UsageDetail {
|
||||
- data : int
|
||||
- duration : int
|
||||
- userId : String
|
||||
+ UsageDetail()
|
||||
+ getData() : int
|
||||
+ getDuration() : int
|
||||
+ getUserId() : String
|
||||
+ setData(data : int)
|
||||
+ setDuration(duration : int)
|
||||
+ setUserId(userId : String)
|
||||
}
|
||||
}
|
||||
package com.iluwatar.claimcheckpattern.utility {
|
||||
class EventHandlerUtility<T> {
|
||||
- customEventClient : EventGridPublisherClient<BinaryData>
|
||||
+ EventHandlerUtility<T>()
|
||||
+ EventHandlerUtility<T>(customEventClient : EventGridPublisherClient<BinaryData>)
|
||||
+ publishEvent(customEvent : T, logger : Logger)
|
||||
}
|
||||
class MessageHandlerUtility<T> {
|
||||
- blobServiceClient : BlobServiceClient
|
||||
+ MessageHandlerUtility<T>()
|
||||
+ MessageHandlerUtility<T>(blobServiceClient : BlobServiceClient)
|
||||
+ dropToPersistantStorage(message : Message<T>, logger : Logger)
|
||||
+ readFromPersistantStorage(messageReference : MessageReference, logger : Logger) : Message<T>
|
||||
}
|
||||
}
|
||||
package com.iluwatar.claimcheckpattern.consumer.callcostprocessor.functions {
|
||||
class UsageCostProcessorFunction {
|
||||
- messageHandlerUtilityForUsageCostDetail : MessageHandlerUtility<UsageCostDetail>
|
||||
- messageHandlerUtilityForUsageDetail : MessageHandlerUtility<UsageDetail>
|
||||
+ UsageCostProcessorFunction()
|
||||
+ UsageCostProcessorFunction(messageHandlerUtilityForUsageDetail : MessageHandlerUtility<UsageDetail>, messageHandlerUtilityForUsageCostDetail : MessageHandlerUtility<UsageCostDetail>)
|
||||
- calculateUsageCostDetails(usageDetailsList : List<UsageDetail>) : List<UsageCostDetail>
|
||||
+ run(request : HttpRequestMessage<Optional<String>>, context : ExecutionContext) : HttpResponseMessage
|
||||
}
|
||||
}
|
||||
UsageCostProcessorFunction --> "-messageHandlerUtilityForUsageDetail" MessageHandlerUtility
|
||||
Message --> "-messageBody" MessageBody
|
||||
UsageDetailPublisherFunction --> "-eventHandlerUtility" EventHandlerUtility
|
||||
Builder ..+ HttpResponseMessage
|
||||
UsageDetailPublisherFunction --> "-messageHandlerUtility" MessageHandlerUtility
|
||||
Message --> "-messageHeader" MessageHeader
|
||||
@enduml
|
7
cloud-claim-check-pattern/call-usage-app/host.json
Normal file
7
cloud-claim-check-pattern/call-usage-app/host.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": "2.0",
|
||||
"extensionBundle": {
|
||||
"id": "Microsoft.Azure.Functions.ExtensionBundle",
|
||||
"version": "[1.*, 2.0.0)"
|
||||
}
|
||||
}
|
150
cloud-claim-check-pattern/call-usage-app/pom.xml
Normal file
150
cloud-claim-check-pattern/call-usage-app/pom.xml
Normal file
@ -0,0 +1,150 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!--
|
||||
|
||||
The MIT License
|
||||
Copyright © 2014-2021 Ilkka Seppälä
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
-->
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
<parent>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<artifactId>claim-check-pattern</artifactId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>call-usage-app</artifactId>
|
||||
<name>call-usage-app</name>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<azure.functions.maven.plugin.version>1.14.0</azure.functions.maven.plugin.version>
|
||||
<azure.functions.java.library.version>1.4.2</azure.functions.java.library.version>
|
||||
<functionAppName>CallUsageApp</functionAppName>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.azure</groupId>
|
||||
<artifactId>azure-sdk-bom</artifactId>
|
||||
<version>1.0.4</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.microsoft.azure.functions</groupId>
|
||||
<artifactId>azure-functions-java-library</artifactId>
|
||||
<version>${azure.functions.java.library.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.azure</groupId>
|
||||
<artifactId>azure-messaging-eventgrid</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.azure</groupId>
|
||||
<artifactId>azure-storage-blob</artifactId>
|
||||
<version>12.13.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Test -->
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>com.microsoft.azure</groupId>
|
||||
<artifactId>azure-functions-maven-plugin</artifactId>
|
||||
<version>${azure.functions.maven.plugin.version}</version>
|
||||
<configuration>
|
||||
<!-- function app name -->
|
||||
<appName>${functionAppName}</appName>
|
||||
<!-- function app resource group -->
|
||||
<resourceGroup>java-functions-group</resourceGroup>
|
||||
<!-- function app service plan name -->
|
||||
<appServicePlanName>java-functions-app-service-plan</appServicePlanName>
|
||||
<!-- function app region-->
|
||||
<!-- refers https://github.com/microsoft/azure-maven-plugins/wiki/Azure-Functions:-Configuration-Details#supported-regions for all valid values -->
|
||||
<region>westus</region>
|
||||
<!-- function pricingTier, default to be consumption if not specified -->
|
||||
<!-- refers https://github.com/microsoft/azure-maven-plugins/wiki/Azure-Functions:-Configuration-Details#supported-pricing-tiers for all valid values -->
|
||||
<!-- <pricingTier></pricingTier> -->
|
||||
<!-- Whether to disable application insights, default is false -->
|
||||
<!-- refers https://github.com/microsoft/azure-maven-plugins/wiki/Azure-Functions:-Configuration-Details for all valid configurations for application insights-->
|
||||
<!-- <disableAppInsights></disableAppInsights> -->
|
||||
<runtime>
|
||||
<!-- runtime os, could be windows, linux or docker-->
|
||||
<os>windows</os>
|
||||
<javaVersion>11</javaVersion>
|
||||
</runtime>
|
||||
<appSettings>
|
||||
<property>
|
||||
<name>FUNCTIONS_EXTENSION_VERSION</name>
|
||||
<value>~3</value>
|
||||
</property>
|
||||
</appSettings>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>package-functions</id>
|
||||
<goals>
|
||||
<goal>package</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!--Remove obj folder generated by .NET SDK in maven clean-->
|
||||
<plugin>
|
||||
<artifactId>maven-clean-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<configuration>
|
||||
<filesets>
|
||||
<fileset>
|
||||
<directory>obj</directory>
|
||||
</fileset>
|
||||
</filesets>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
@ -0,0 +1,168 @@
|
||||
/*
|
||||
* The MIT License
|
||||
* Copyright © 2014-2021 Ilkka Seppälä
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.iluwatar.claimcheckpattern.consumer.callcostprocessor.functions;
|
||||
|
||||
import com.azure.core.util.BinaryData;
|
||||
import com.azure.core.util.serializer.TypeReference;
|
||||
import com.azure.messaging.eventgrid.EventGridEvent;
|
||||
import com.azure.messaging.eventgrid.systemevents.SubscriptionValidationEventData;
|
||||
import com.azure.messaging.eventgrid.systemevents.SubscriptionValidationResponse;
|
||||
import com.iluwatar.claimcheckpattern.domain.Message;
|
||||
import com.iluwatar.claimcheckpattern.domain.MessageBody;
|
||||
import com.iluwatar.claimcheckpattern.domain.MessageHeader;
|
||||
import com.iluwatar.claimcheckpattern.domain.MessageReference;
|
||||
import com.iluwatar.claimcheckpattern.domain.UsageCostDetail;
|
||||
import com.iluwatar.claimcheckpattern.domain.UsageDetail;
|
||||
import com.iluwatar.claimcheckpattern.utility.MessageHandlerUtility;
|
||||
import com.microsoft.azure.functions.ExecutionContext;
|
||||
import com.microsoft.azure.functions.HttpMethod;
|
||||
import com.microsoft.azure.functions.HttpRequestMessage;
|
||||
import com.microsoft.azure.functions.HttpResponseMessage;
|
||||
import com.microsoft.azure.functions.HttpStatus;
|
||||
import com.microsoft.azure.functions.annotation.AuthorizationLevel;
|
||||
import com.microsoft.azure.functions.annotation.FunctionName;
|
||||
import com.microsoft.azure.functions.annotation.HttpTrigger;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Azure Functions with HTTP Trigger.
|
||||
* This is Consumer class.
|
||||
*/
|
||||
public class UsageCostProcessorFunction {
|
||||
|
||||
private MessageHandlerUtility<UsageDetail> messageHandlerUtilityForUsageDetail;
|
||||
private MessageHandlerUtility<UsageCostDetail> messageHandlerUtilityForUsageCostDetail;
|
||||
|
||||
public UsageCostProcessorFunction() {
|
||||
this.messageHandlerUtilityForUsageDetail = new MessageHandlerUtility<>();
|
||||
this.messageHandlerUtilityForUsageCostDetail = new MessageHandlerUtility<>();
|
||||
}
|
||||
|
||||
public UsageCostProcessorFunction(
|
||||
MessageHandlerUtility<UsageDetail> messageHandlerUtilityForUsageDetail,
|
||||
MessageHandlerUtility<UsageCostDetail> messageHandlerUtilityForUsageCostDetail) {
|
||||
this.messageHandlerUtilityForUsageDetail = messageHandlerUtilityForUsageDetail;
|
||||
this.messageHandlerUtilityForUsageCostDetail = messageHandlerUtilityForUsageCostDetail;
|
||||
}
|
||||
|
||||
/**
|
||||
* Azure function which gets triggered when event grid event send event to it.
|
||||
* After receiving event, it read input file from blob storage, calculate call cost details.
|
||||
* It creates new message with cost details and drop message to blob storage.
|
||||
* @param request represents HttpRequestMessage
|
||||
* @param context represents ExecutionContext
|
||||
* @return HttpResponseMessage
|
||||
*/
|
||||
@FunctionName("UsageCostProcessorFunction")
|
||||
public HttpResponseMessage run(@HttpTrigger(name = "req", methods = { HttpMethod.GET,
|
||||
HttpMethod.POST }, authLevel = AuthorizationLevel.ANONYMOUS)
|
||||
HttpRequestMessage<Optional<String>> request,
|
||||
final ExecutionContext context) {
|
||||
try {
|
||||
var eventGridEvents = EventGridEvent.fromString(request.getBody().get());
|
||||
for (var eventGridEvent : eventGridEvents) {
|
||||
// Handle system events
|
||||
if (eventGridEvent.getEventType()
|
||||
.equals("Microsoft.EventGrid.SubscriptionValidationEvent")) {
|
||||
SubscriptionValidationEventData subscriptionValidationEventData = eventGridEvent.getData()
|
||||
.toObject(SubscriptionValidationEventData.class);
|
||||
// Handle the subscription validation event
|
||||
var responseData = new SubscriptionValidationResponse();
|
||||
responseData.setValidationResponse(subscriptionValidationEventData.getValidationCode());
|
||||
return request.createResponseBuilder(HttpStatus.OK).body(responseData).build();
|
||||
|
||||
} else if (eventGridEvent.getEventType().equals("UsageDetail")) {
|
||||
// Get message header and reference
|
||||
var messageReference = eventGridEvent.getData()
|
||||
.toObject(MessageReference.class);
|
||||
|
||||
// Read message from persistent storage
|
||||
var message = this.messageHandlerUtilityForUsageDetail
|
||||
.readFromPersistantStorage(messageReference, context.getLogger());
|
||||
|
||||
// Get Data and generate cost details
|
||||
List<UsageDetail> usageDetailsList = BinaryData.fromObject(
|
||||
message.getMessageBody().getData())
|
||||
.toObject(new TypeReference<>() {
|
||||
});
|
||||
var usageCostDetailsList = calculateUsageCostDetails(usageDetailsList);
|
||||
|
||||
// Create message body
|
||||
var newMessageBody = new MessageBody<UsageCostDetail>();
|
||||
newMessageBody.setData(usageCostDetailsList);
|
||||
|
||||
// Create message header
|
||||
var newMessageReference = new MessageReference("callusageapp",
|
||||
eventGridEvent.getId() + "/output.json");
|
||||
var newMessageHeader = new MessageHeader();
|
||||
newMessageHeader.setId(eventGridEvent.getId());
|
||||
newMessageHeader.setSubject("UsageCostProcessor");
|
||||
newMessageHeader.setTopic("");
|
||||
newMessageHeader.setEventType("UsageCostDetail");
|
||||
newMessageHeader.setEventTime(OffsetDateTime.now().toString());
|
||||
newMessageHeader.setData(newMessageReference);
|
||||
newMessageHeader.setDataVersion("v1.0");
|
||||
|
||||
// Create entire message
|
||||
var newMessage = new Message<UsageCostDetail>();
|
||||
newMessage.setMessageHeader(newMessageHeader);
|
||||
newMessage.setMessageBody(newMessageBody);
|
||||
|
||||
// Drop data to persistent storage
|
||||
this.messageHandlerUtilityForUsageCostDetail.dropToPersistantStorage(newMessage,
|
||||
context.getLogger());
|
||||
|
||||
context.getLogger().info("Message is dropped successfully");
|
||||
return request.createResponseBuilder(HttpStatus.OK)
|
||||
.body("Message is dropped successfully").build();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
context.getLogger().warning(e.getMessage());
|
||||
}
|
||||
|
||||
return request.createResponseBuilder(HttpStatus.INTERNAL_SERVER_ERROR).body(null).build();
|
||||
}
|
||||
|
||||
private List<UsageCostDetail> calculateUsageCostDetails(List<UsageDetail> usageDetailsList) {
|
||||
if (usageDetailsList == null) {
|
||||
return null;
|
||||
}
|
||||
var usageCostDetailsList = new ArrayList<UsageCostDetail>();
|
||||
|
||||
usageDetailsList.forEach(usageDetail -> {
|
||||
var usageCostDetail = new UsageCostDetail();
|
||||
usageCostDetail.setUserId(usageDetail.getUserId());
|
||||
usageCostDetail.setCallCost(usageDetail.getDuration() * 0.30); // 0.30₹ per minute
|
||||
usageCostDetail.setDataCost(usageDetail.getData() * 0.20); // 0.20₹ per MB
|
||||
|
||||
usageCostDetailsList.add(usageCostDetail);
|
||||
});
|
||||
|
||||
return usageCostDetailsList;
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* The MIT License
|
||||
* Copyright © 2014-2021 Ilkka Seppälä
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.iluwatar.claimcheckpattern.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* It is the message which gets dropped or read by Producer or Consumer Azure functions.
|
||||
* It is stored in the json format.
|
||||
* @param <T> represents UsageDetail or UsageCostDetail
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Message<T> {
|
||||
private MessageHeader messageHeader;
|
||||
|
||||
private MessageBody<T> messageBody;
|
||||
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* The MIT License
|
||||
* Copyright © 2014-2021 Ilkka Seppälä
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.iluwatar.claimcheckpattern.domain;
|
||||
|
||||
import java.util.List;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* It is message body of the message.
|
||||
* It stores actual data in our case UsageCostDetail or UsageDetail.
|
||||
* @param <T> represents UsageDetail or UsageCostDetail
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class MessageBody<T> {
|
||||
|
||||
private List<T> data;
|
||||
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* The MIT License
|
||||
* Copyright © 2014-2021 Ilkka Seppälä
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.iluwatar.claimcheckpattern.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* This is message header or event which is sent to Event Grid.
|
||||
* Its structure is same as Azure Event Grid Event Class.
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class MessageHeader {
|
||||
|
||||
private String id;
|
||||
private String subject;
|
||||
private String topic;
|
||||
private String eventType;
|
||||
private String eventTime;
|
||||
private Object data;
|
||||
private String dataVersion;
|
||||
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* The MIT License
|
||||
* Copyright © 2014-2021 Ilkka Seppälä
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.iluwatar.claimcheckpattern.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* This is claim/message reference class.
|
||||
* It contains the information about data where it is stored in persistent storage
|
||||
* and file name.
|
||||
* dataLocation is blob storage container name.
|
||||
* dataFileName is file name in above container.
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class MessageReference {
|
||||
|
||||
private String dataLocation;
|
||||
private String dataFileName;
|
||||
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* The MIT License
|
||||
* Copyright © 2014-2021 Ilkka Seppälä
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.iluwatar.claimcheckpattern.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* This is call cost details class.
|
||||
* It stores userId of the caller, call duration cost and data cost.
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class UsageCostDetail {
|
||||
|
||||
private String userId;
|
||||
private double callCost;
|
||||
private double dataCost;
|
||||
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* The MIT License
|
||||
* Copyright © 2014-2021 Ilkka Seppälä
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.iluwatar.claimcheckpattern.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* This is call usage detail calls.
|
||||
* It stores userId of the caller, call duration and data used.
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class UsageDetail {
|
||||
|
||||
private String userId;
|
||||
|
||||
private int duration;
|
||||
|
||||
private int data;
|
||||
}
|
@ -0,0 +1,146 @@
|
||||
/*
|
||||
* The MIT License
|
||||
* Copyright © 2014-2021 Ilkka Seppälä
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.iluwatar.claimcheckpattern.producer.calldetails.functions;
|
||||
|
||||
import com.azure.messaging.eventgrid.EventGridEvent;
|
||||
import com.azure.messaging.eventgrid.systemevents.SubscriptionValidationEventData;
|
||||
import com.azure.messaging.eventgrid.systemevents.SubscriptionValidationResponse;
|
||||
import com.iluwatar.claimcheckpattern.domain.Message;
|
||||
import com.iluwatar.claimcheckpattern.domain.MessageBody;
|
||||
import com.iluwatar.claimcheckpattern.domain.MessageHeader;
|
||||
import com.iluwatar.claimcheckpattern.domain.MessageReference;
|
||||
import com.iluwatar.claimcheckpattern.domain.UsageDetail;
|
||||
import com.iluwatar.claimcheckpattern.utility.EventHandlerUtility;
|
||||
import com.iluwatar.claimcheckpattern.utility.MessageHandlerUtility;
|
||||
import com.microsoft.azure.functions.ExecutionContext;
|
||||
import com.microsoft.azure.functions.HttpMethod;
|
||||
import com.microsoft.azure.functions.HttpRequestMessage;
|
||||
import com.microsoft.azure.functions.HttpResponseMessage;
|
||||
import com.microsoft.azure.functions.HttpStatus;
|
||||
import com.microsoft.azure.functions.annotation.AuthorizationLevel;
|
||||
import com.microsoft.azure.functions.annotation.FunctionName;
|
||||
import com.microsoft.azure.functions.annotation.HttpTrigger;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Azure Functions with HTTP Trigger.
|
||||
* This is Producer class.
|
||||
*/
|
||||
public class UsageDetailPublisherFunction {
|
||||
|
||||
private MessageHandlerUtility<UsageDetail> messageHandlerUtility;
|
||||
private EventHandlerUtility<MessageHeader> eventHandlerUtility;
|
||||
|
||||
public UsageDetailPublisherFunction() {
|
||||
this.messageHandlerUtility = new MessageHandlerUtility<>();
|
||||
this.eventHandlerUtility = new EventHandlerUtility<>();
|
||||
}
|
||||
|
||||
public UsageDetailPublisherFunction(MessageHandlerUtility<UsageDetail> messageHandlerUtility,
|
||||
EventHandlerUtility<MessageHeader> eventHandlerUtility) {
|
||||
this.messageHandlerUtility = messageHandlerUtility;
|
||||
this.eventHandlerUtility = eventHandlerUtility;
|
||||
}
|
||||
|
||||
/**
|
||||
* Azure function which create message, drop it in persistent storage
|
||||
* and publish the event to Event Grid topic.
|
||||
* @param request represents HttpRequestMessage
|
||||
* @param context represents ExecutionContext
|
||||
* @return HttpResponseMessage
|
||||
*/
|
||||
@FunctionName("UsageDetailPublisherFunction")
|
||||
public HttpResponseMessage run(@HttpTrigger(name = "req", methods = {
|
||||
HttpMethod.POST }, authLevel = AuthorizationLevel.ANONYMOUS)
|
||||
HttpRequestMessage<Optional<String>> request,
|
||||
final ExecutionContext context) {
|
||||
try {
|
||||
|
||||
var eventGridEvents = EventGridEvent.fromString(request.getBody().get());
|
||||
|
||||
for (EventGridEvent eventGridEvent : eventGridEvents) {
|
||||
// Handle system events
|
||||
if (eventGridEvent.getEventType()
|
||||
.equals("Microsoft.EventGrid.SubscriptionValidationEvent")) {
|
||||
SubscriptionValidationEventData subscriptionValidationEventData = eventGridEvent.getData()
|
||||
.toObject(SubscriptionValidationEventData.class);
|
||||
// Handle the subscription validation event
|
||||
var responseData = new SubscriptionValidationResponse();
|
||||
responseData.setValidationResponse(subscriptionValidationEventData.getValidationCode());
|
||||
return request.createResponseBuilder(HttpStatus.OK).body(responseData).build();
|
||||
|
||||
} else if (eventGridEvent.getEventType().equals("UsageDetail")) {
|
||||
// Create message body
|
||||
var messageBody = new MessageBody<UsageDetail>();
|
||||
var usageDetailsList = new ArrayList<UsageDetail>();
|
||||
var random = new Random();
|
||||
for (int i = 0; i < 51; i++) {
|
||||
var usageDetail = new UsageDetail();
|
||||
usageDetail.setUserId("userId" + i);
|
||||
usageDetail.setData(random.nextInt(500));
|
||||
usageDetail.setDuration(random.nextInt(500));
|
||||
|
||||
usageDetailsList.add(usageDetail);
|
||||
}
|
||||
messageBody.setData(usageDetailsList);
|
||||
|
||||
// Create message header
|
||||
var messageHeader = new MessageHeader();
|
||||
messageHeader.setId(UUID.randomUUID().toString());
|
||||
messageHeader.setSubject("UsageDetailPublisher");
|
||||
messageHeader.setTopic("usagecostprocessorfunction-topic");
|
||||
messageHeader.setEventType("UsageDetail");
|
||||
messageHeader.setEventTime(OffsetDateTime.now().toString());
|
||||
var messageReference = new MessageReference("callusageapp",
|
||||
messageHeader.getId() + "/input.json");
|
||||
messageHeader.setData(messageReference);
|
||||
messageHeader.setDataVersion("v1.0");
|
||||
|
||||
// Create entire message
|
||||
var message = new Message<UsageDetail>();
|
||||
message.setMessageHeader(messageHeader);
|
||||
message.setMessageBody(messageBody);
|
||||
|
||||
// Drop data to persistent storage
|
||||
this.messageHandlerUtility.dropToPersistantStorage(message, context.getLogger());
|
||||
|
||||
// Publish event to event grid topic
|
||||
eventHandlerUtility.publishEvent(messageHeader, context.getLogger());
|
||||
|
||||
context.getLogger().info("Message is dropped and event is published successfully");
|
||||
return request.createResponseBuilder(HttpStatus.OK).body(message).build();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
context.getLogger().warning(e.getMessage());
|
||||
}
|
||||
|
||||
return request.createResponseBuilder(HttpStatus.OK).body(null).build();
|
||||
}
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* The MIT License
|
||||
* Copyright © 2014-2021 Ilkka Seppälä
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.iluwatar.claimcheckpattern.utility;
|
||||
|
||||
import com.azure.core.credential.AzureKeyCredential;
|
||||
import com.azure.core.util.BinaryData;
|
||||
import com.azure.messaging.eventgrid.EventGridPublisherClient;
|
||||
import com.azure.messaging.eventgrid.EventGridPublisherClientBuilder;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* This class is event publisher utility which published message header to Event Grid topic.
|
||||
* @param <T> represents UsageDetail or UsageCostDetail
|
||||
*/
|
||||
public class EventHandlerUtility<T> {
|
||||
|
||||
private EventGridPublisherClient<BinaryData> customEventClient;
|
||||
|
||||
/** Default constructor.
|
||||
*/
|
||||
public EventHandlerUtility() {
|
||||
this.customEventClient = new EventGridPublisherClientBuilder()
|
||||
.endpoint(System.getenv("EventGridURL"))
|
||||
.credential(new AzureKeyCredential(System.getenv("EventGridKey")))
|
||||
.buildCustomEventPublisherClient();
|
||||
}
|
||||
|
||||
/**
|
||||
Parameterized constructor.
|
||||
*/
|
||||
public EventHandlerUtility(EventGridPublisherClient<BinaryData> customEventClient) {
|
||||
this.customEventClient = customEventClient;
|
||||
}
|
||||
|
||||
/**
|
||||
Method for publishing event to Event Grid Topic.
|
||||
*/
|
||||
public void publishEvent(T customEvent, Logger logger) {
|
||||
try {
|
||||
customEventClient.sendEvent(BinaryData.fromObject(customEvent));
|
||||
} catch (Exception e) {
|
||||
logger.info(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,127 @@
|
||||
/*
|
||||
* The MIT License
|
||||
* Copyright © 2014-2021 Ilkka Seppälä
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.iluwatar.claimcheckpattern.utility;
|
||||
|
||||
import com.azure.core.util.BinaryData;
|
||||
import com.azure.core.util.serializer.TypeReference;
|
||||
import com.azure.storage.blob.BlobClient;
|
||||
import com.azure.storage.blob.BlobContainerClient;
|
||||
import com.azure.storage.blob.BlobServiceClient;
|
||||
import com.azure.storage.blob.BlobServiceClientBuilder;
|
||||
import com.iluwatar.claimcheckpattern.domain.Message;
|
||||
import com.iluwatar.claimcheckpattern.domain.MessageReference;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* This class read and drop message from Azure blob storage.
|
||||
* @param <T> represents UsageDetail or UsageCostDetail
|
||||
*/
|
||||
public class MessageHandlerUtility<T> {
|
||||
|
||||
private BlobServiceClient blobServiceClient;
|
||||
|
||||
/**
|
||||
* Parameterized constructor.
|
||||
* @param blobServiceClient represents BlobServiceClient
|
||||
*/
|
||||
public MessageHandlerUtility(BlobServiceClient blobServiceClient) {
|
||||
this.blobServiceClient = blobServiceClient;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public MessageHandlerUtility() {
|
||||
// Create a BlobServiceClient object which will be used to create a container
|
||||
// client
|
||||
this.blobServiceClient = new BlobServiceClientBuilder()
|
||||
.connectionString(System.getenv("BlobStorageConnectionString")).buildClient();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Read message from blob storage.
|
||||
* @param messageReference represents MessageReference
|
||||
* @param logger represents Logger
|
||||
* @return Message
|
||||
*/
|
||||
public Message<T> readFromPersistantStorage(MessageReference messageReference, Logger logger) {
|
||||
Message<T> message = null;
|
||||
try {
|
||||
|
||||
// Get container name from message reference
|
||||
String containerName = messageReference.getDataLocation();
|
||||
|
||||
// Get blob name from message reference
|
||||
String blobName = messageReference.getDataFileName();
|
||||
|
||||
// Get container client
|
||||
BlobContainerClient containerClient = blobServiceClient.getBlobContainerClient(containerName);
|
||||
|
||||
// Get a reference to a blob
|
||||
BlobClient blobClient = containerClient.getBlobClient(blobName);
|
||||
|
||||
// download the blob
|
||||
message = blobClient.downloadContent().toObject(new TypeReference<Message<T>>() {
|
||||
});
|
||||
} catch (Exception e) {
|
||||
logger.info(e.getMessage());
|
||||
}
|
||||
return message;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Drop message to blob storage.
|
||||
* @param message represents Message
|
||||
* @param logger represents Logger
|
||||
*/
|
||||
public void dropToPersistantStorage(Message<T> message, Logger logger) {
|
||||
try {
|
||||
|
||||
// Get message reference
|
||||
MessageReference messageReference = (MessageReference) message.getMessageHeader().getData();
|
||||
|
||||
// Create a unique name for the container
|
||||
String containerName = messageReference.getDataLocation();
|
||||
|
||||
// Create the container and return a container client object
|
||||
BlobContainerClient containerClient = this.blobServiceClient
|
||||
.getBlobContainerClient(containerName);
|
||||
if (!containerClient.exists()) {
|
||||
containerClient.create();
|
||||
}
|
||||
|
||||
// Get a reference to a blob
|
||||
BlobClient blobClient = containerClient.getBlobClient(messageReference.getDataFileName());
|
||||
|
||||
// Upload the blob
|
||||
blobClient.upload(BinaryData.fromObject(message));
|
||||
} catch (Exception e) {
|
||||
logger.info(e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,105 @@
|
||||
/*
|
||||
* The MIT License
|
||||
* Copyright © 2014-2021 Ilkka Seppälä
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.iluwatar.claimcheckpattern;
|
||||
|
||||
import com.microsoft.azure.functions.HttpResponseMessage;
|
||||
import com.microsoft.azure.functions.HttpStatus;
|
||||
import com.microsoft.azure.functions.HttpStatusType;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* The mock for HttpResponseMessage, can be used in unit tests to verify if the
|
||||
* returned response by HTTP trigger function is correct or not.
|
||||
*/
|
||||
public class HttpResponseMessageMock implements HttpResponseMessage {
|
||||
private int httpStatusCode;
|
||||
private HttpStatusType httpStatus;
|
||||
private Object body;
|
||||
private Map<String, String> headers;
|
||||
|
||||
public HttpResponseMessageMock(HttpStatusType status, Map<String, String> headers, Object body) {
|
||||
this.httpStatus = status;
|
||||
this.httpStatusCode = status.value();
|
||||
this.headers = headers;
|
||||
this.body = body;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpStatusType getStatus() {
|
||||
return this.httpStatus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatusCode() {
|
||||
return httpStatusCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHeader(String key) {
|
||||
return this.headers.get(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getBody() {
|
||||
return this.body;
|
||||
}
|
||||
|
||||
public static class HttpResponseMessageBuilderMock implements HttpResponseMessage.Builder {
|
||||
private Object body;
|
||||
private int httpStatusCode;
|
||||
private Map<String, String> headers = new HashMap<>();
|
||||
private HttpStatusType httpStatus;
|
||||
|
||||
public Builder status(HttpStatus status) {
|
||||
this.httpStatusCode = status.value();
|
||||
this.httpStatus = status;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder status(HttpStatusType httpStatusType) {
|
||||
this.httpStatusCode = httpStatusType.value();
|
||||
this.httpStatus = httpStatusType;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResponseMessage.Builder header(String key, String value) {
|
||||
this.headers.put(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResponseMessage.Builder body(Object body) {
|
||||
this.body = body;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResponseMessage build() {
|
||||
return new HttpResponseMessageMock(this.httpStatus, this.headers, this.body);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,181 @@
|
||||
/*
|
||||
* The MIT License
|
||||
* Copyright © 2014-2021 Ilkka Seppälä
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.iluwatar.claimcheckpattern.consumer.callcostprocessor.functions;
|
||||
|
||||
import com.iluwatar.claimcheckpattern.HttpResponseMessageMock;
|
||||
import com.iluwatar.claimcheckpattern.domain.Message;
|
||||
import com.iluwatar.claimcheckpattern.domain.MessageBody;
|
||||
import com.iluwatar.claimcheckpattern.domain.MessageHeader;
|
||||
import com.iluwatar.claimcheckpattern.domain.MessageReference;
|
||||
import com.iluwatar.claimcheckpattern.domain.UsageCostDetail;
|
||||
import com.iluwatar.claimcheckpattern.domain.UsageDetail;
|
||||
import com.iluwatar.claimcheckpattern.utility.MessageHandlerUtility;
|
||||
import com.microsoft.azure.functions.ExecutionContext;
|
||||
import com.microsoft.azure.functions.HttpRequestMessage;
|
||||
import com.microsoft.azure.functions.HttpResponseMessage;
|
||||
import com.microsoft.azure.functions.HttpStatus;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.invocation.InvocationOnMock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.mockito.stubbing.Answer;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.util.*;
|
||||
import java.util.logging.Logger;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
/**
|
||||
* Unit test for Function class.
|
||||
*/
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class UsageCostProcessorFunctionTest {
|
||||
|
||||
@Mock
|
||||
MessageHandlerUtility<UsageDetail> mockMessageHandlerUtilityForUsageADetail;
|
||||
@Mock
|
||||
MessageHandlerUtility<UsageCostDetail> mockMessageHandlerUtilityForUsageCostDetail;
|
||||
@Mock
|
||||
ExecutionContext context;
|
||||
|
||||
Message<UsageCostDetail> messageToDrop;
|
||||
Message<UsageDetail> messageToRead;
|
||||
MessageReference messageReference;
|
||||
@InjectMocks
|
||||
UsageCostProcessorFunction usageCostProcessorFunction;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
var messageBodyUsageDetail = new MessageBody<UsageDetail>();
|
||||
var usageDetailsList = new ArrayList<UsageDetail>();
|
||||
|
||||
var messageBodyUsageCostDetail = new MessageBody<UsageCostDetail>();
|
||||
var usageCostDetailsList = new ArrayList<UsageCostDetail>();
|
||||
for (int i = 0; i < 2; i++) {
|
||||
var usageDetail = new UsageDetail();
|
||||
usageDetail.setUserId("userId" + i);
|
||||
usageDetail.setData(i + 1);
|
||||
usageDetail.setDuration(i + 1);
|
||||
usageDetailsList.add(usageDetail);
|
||||
|
||||
var usageCostDetail = new UsageCostDetail();
|
||||
usageCostDetail.setUserId(usageDetail.getUserId());
|
||||
usageCostDetail.setDataCost(usageDetail.getData() * 0.20);
|
||||
usageCostDetail.setCallCost(usageDetail.getDuration() * 0.30);
|
||||
usageCostDetailsList.add(usageCostDetail);
|
||||
}
|
||||
messageBodyUsageDetail.setData(usageDetailsList);
|
||||
messageBodyUsageCostDetail.setData(usageCostDetailsList);
|
||||
|
||||
// Create message header
|
||||
var messageHeader = new MessageHeader();
|
||||
messageHeader.setId(UUID.randomUUID().toString());
|
||||
messageHeader.setSubject("UsageDetailPublisher");
|
||||
messageHeader.setTopic("usagecostprocessorfunction-topic");
|
||||
messageHeader.setEventType("UsageDetail");
|
||||
messageHeader.setEventTime(OffsetDateTime.now().toString());
|
||||
this.messageReference = new MessageReference("callusageapp", "d8284456-dfff-4bd4-9cef-ea99f70f4835/input.json");
|
||||
messageHeader.setData(messageReference);
|
||||
messageHeader.setDataVersion("v1.0");
|
||||
|
||||
// Create entire message
|
||||
messageToRead = new Message<>();
|
||||
messageToRead.setMessageHeader(messageHeader);
|
||||
messageToRead.setMessageBody(messageBodyUsageDetail);
|
||||
|
||||
messageToDrop = new Message<>();
|
||||
messageToDrop.setMessageHeader(messageHeader);
|
||||
messageToDrop.setMessageBody(messageBodyUsageCostDetail);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Unit test for HttpTriggerJava method.
|
||||
*/
|
||||
@Test
|
||||
public void shouldTriggerHttpAzureFunctionJavaWithSubscriptionValidationEventType() throws Exception {
|
||||
|
||||
// Setup
|
||||
@SuppressWarnings("unchecked")
|
||||
final HttpRequestMessage<Optional<String>> req = mock(HttpRequestMessage.class);
|
||||
String fileAbsolutePath = getClass().getResource("/subscriptionValidationEvent.json").getPath()
|
||||
.replaceAll("%20", " "), jsonBody = Files.readString(Paths.get(fileAbsolutePath)).replaceAll("\n", " ");
|
||||
doReturn(Optional.of(jsonBody)).when(req).getBody();
|
||||
doAnswer(new Answer<HttpResponseMessage.Builder>() {
|
||||
@Override
|
||||
public HttpResponseMessage.Builder answer(InvocationOnMock invocation) {
|
||||
HttpStatus status = (HttpStatus) invocation.getArguments()[0];
|
||||
return new HttpResponseMessageMock.HttpResponseMessageBuilderMock().status(status);
|
||||
}
|
||||
}).when(req).createResponseBuilder(any(HttpStatus.class));
|
||||
|
||||
final ExecutionContext context = mock(ExecutionContext.class);
|
||||
|
||||
// Invoke
|
||||
final HttpResponseMessage ret = this.usageCostProcessorFunction.run(req, context);
|
||||
|
||||
// Verify
|
||||
assertEquals(ret.getStatus(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldTriggerHttpAzureFunctionJavaWithUsageDetailEventType() throws Exception {
|
||||
// Setup
|
||||
@SuppressWarnings("unchecked")
|
||||
final HttpRequestMessage<Optional<String>> req = mock(HttpRequestMessage.class);
|
||||
String fileAbsolutePath = getClass().getResource("/usageDetailEvent.json").getPath().replaceAll("%20", " "),
|
||||
jsonBody = Files.readString(Paths.get(fileAbsolutePath)).replaceAll("\n", " ");
|
||||
doReturn(Optional.of(jsonBody)).when(req).getBody();
|
||||
doReturn(Logger.getGlobal()).when(context).getLogger();
|
||||
|
||||
when(this.mockMessageHandlerUtilityForUsageADetail.readFromPersistantStorage(any(MessageReference.class),
|
||||
eq(Logger.getGlobal()))).thenReturn(messageToRead);
|
||||
doAnswer(new Answer<HttpResponseMessage.Builder>() {
|
||||
@Override
|
||||
public HttpResponseMessage.Builder answer(InvocationOnMock invocation) {
|
||||
HttpStatus status = (HttpStatus) invocation.getArguments()[0];
|
||||
return new HttpResponseMessageMock.HttpResponseMessageBuilderMock().status(status);
|
||||
}
|
||||
}).when(req).createResponseBuilder(any(HttpStatus.class));
|
||||
|
||||
assertNotNull(this.mockMessageHandlerUtilityForUsageADetail);
|
||||
assertEquals(this.messageToRead, this.mockMessageHandlerUtilityForUsageADetail
|
||||
.readFromPersistantStorage(this.messageReference, Logger.getGlobal()));
|
||||
|
||||
// Invoke
|
||||
final HttpResponseMessage ret = this.usageCostProcessorFunction.run(req, context);
|
||||
|
||||
// Verify
|
||||
assertEquals(HttpStatus.OK, ret.getStatus());
|
||||
assertEquals("Message is dropped successfully", ret.getBody());
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,119 @@
|
||||
/*
|
||||
* The MIT License
|
||||
* Copyright © 2014-2021 Ilkka Seppälä
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.iluwatar.claimcheckpattern.producer.calldetails.functions;
|
||||
|
||||
import com.iluwatar.claimcheckpattern.HttpResponseMessageMock;
|
||||
import com.iluwatar.claimcheckpattern.domain.MessageHeader;
|
||||
import com.iluwatar.claimcheckpattern.domain.UsageDetail;
|
||||
import com.iluwatar.claimcheckpattern.utility.EventHandlerUtility;
|
||||
import com.iluwatar.claimcheckpattern.utility.MessageHandlerUtility;
|
||||
import com.microsoft.azure.functions.ExecutionContext;
|
||||
import com.microsoft.azure.functions.HttpRequestMessage;
|
||||
import com.microsoft.azure.functions.HttpResponseMessage;
|
||||
import com.microsoft.azure.functions.HttpStatus;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.invocation.InvocationOnMock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.mockito.stubbing.Answer;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.*;
|
||||
import java.util.logging.Logger;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
/**
|
||||
* Unit test for Function class.
|
||||
*/
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class UsageDetailPublisherFunctionTest {
|
||||
@Mock
|
||||
MessageHandlerUtility<UsageDetail> mockMessageHandlerUtility;
|
||||
@Mock
|
||||
EventHandlerUtility<MessageHeader> mockEventHandlerUtility;
|
||||
|
||||
@InjectMocks
|
||||
UsageDetailPublisherFunction usageDetailPublisherFunction;
|
||||
|
||||
/**
|
||||
* Unit test for HttpTriggerJava method.
|
||||
*/
|
||||
@Test
|
||||
public void shouldTriggerHttpAzureFunctionJavaWithSubscriptionValidationEventType() throws Exception {
|
||||
|
||||
// Setup
|
||||
@SuppressWarnings("unchecked")
|
||||
final HttpRequestMessage<Optional<String>> req = mock(HttpRequestMessage.class);
|
||||
String fileAbsolutePath = getClass().getResource("/subscriptionValidationEvent.json").getPath()
|
||||
.replaceAll("%20", " "), jsonBody = Files.readString(Paths.get(fileAbsolutePath)).replaceAll("\n", " ");
|
||||
doReturn(Optional.of(jsonBody)).when(req).getBody();
|
||||
doAnswer(new Answer<HttpResponseMessage.Builder>() {
|
||||
@Override
|
||||
public HttpResponseMessage.Builder answer(InvocationOnMock invocation) {
|
||||
HttpStatus status = (HttpStatus) invocation.getArguments()[0];
|
||||
return new HttpResponseMessageMock.HttpResponseMessageBuilderMock().status(status);
|
||||
}
|
||||
}).when(req).createResponseBuilder(any(HttpStatus.class));
|
||||
|
||||
final ExecutionContext context = mock(ExecutionContext.class);
|
||||
|
||||
// Invoke
|
||||
final HttpResponseMessage ret = this.usageDetailPublisherFunction.run(req, context);
|
||||
|
||||
// Verify
|
||||
assertEquals(ret.getStatus(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldTriggerHttpAzureFunctionJavaWithUsageDetailEventType() throws Exception {
|
||||
|
||||
// Setup
|
||||
@SuppressWarnings("unchecked")
|
||||
final HttpRequestMessage<Optional<String>> req = mock(HttpRequestMessage.class);
|
||||
String fileAbsolutePath = getClass().getResource("/usageDetailEvent.json").getPath().replaceAll("%20", " "),
|
||||
jsonBody = Files.readString(Paths.get(fileAbsolutePath)).replaceAll("\n", " ");
|
||||
doReturn(Optional.of(jsonBody)).when(req).getBody();
|
||||
doAnswer(new Answer<HttpResponseMessage.Builder>() {
|
||||
@Override
|
||||
public HttpResponseMessage.Builder answer(InvocationOnMock invocation) {
|
||||
HttpStatus status = (HttpStatus) invocation.getArguments()[0];
|
||||
return new HttpResponseMessageMock.HttpResponseMessageBuilderMock().status(status);
|
||||
}
|
||||
}).when(req).createResponseBuilder(any(HttpStatus.class));
|
||||
|
||||
final ExecutionContext context = mock(ExecutionContext.class);
|
||||
doReturn(Logger.getGlobal()).when(context).getLogger();
|
||||
|
||||
// Invoke
|
||||
final HttpResponseMessage ret = this.usageDetailPublisherFunction.run(req, context);
|
||||
|
||||
// Verify
|
||||
assertEquals(ret.getStatus(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
/*
|
||||
* The MIT License
|
||||
* Copyright © 2014-2021 Ilkka Seppälä
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.iluwatar.claimcheckpattern.utility;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
import com.azure.core.util.BinaryData;
|
||||
import com.azure.messaging.eventgrid.EventGridPublisherClient;
|
||||
import com.iluwatar.claimcheckpattern.domain.Message;
|
||||
import com.iluwatar.claimcheckpattern.domain.UsageDetail;
|
||||
import java.util.logging.Logger;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class EventHandlerUtilityTest {
|
||||
|
||||
@Mock
|
||||
EventGridPublisherClient<BinaryData> mockCustomEventClient;
|
||||
|
||||
@InjectMocks
|
||||
EventHandlerUtility<Message<UsageDetail>> eventHandlerUtility;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
|
||||
System.setProperty("EventGridURL", "https://www.dummyEndpoint.com/api/events");
|
||||
System.setProperty("EventGridKey", "EventGridURL");
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldPublishEvent() {
|
||||
doNothing().when(mockCustomEventClient).sendEvent(any(BinaryData.class));
|
||||
eventHandlerUtility.publishEvent(null, Logger.getLogger("logger"));
|
||||
verify(mockCustomEventClient, times(1)).sendEvent(any(BinaryData.class));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldPublishEventWithNullLogger() {
|
||||
eventHandlerUtility.publishEvent(null, null);
|
||||
verify(mockCustomEventClient, times(1)).sendEvent(any(BinaryData.class));
|
||||
}
|
||||
}
|
@ -0,0 +1,114 @@
|
||||
/*
|
||||
* The MIT License
|
||||
* Copyright © 2014-2021 Ilkka Seppälä
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.iluwatar.claimcheckpattern.utility;
|
||||
|
||||
import com.azure.storage.blob.BlobClient;
|
||||
import com.azure.storage.blob.BlobContainerClient;
|
||||
import com.azure.storage.blob.BlobServiceClient;
|
||||
import com.iluwatar.claimcheckpattern.domain.*;
|
||||
import com.iluwatar.claimcheckpattern.utility.MessageHandlerUtility;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Logger;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class MessageHandlerUtilityTest {
|
||||
@Mock
|
||||
private BlobClient mockBlobClient;
|
||||
|
||||
@Mock
|
||||
private BlobContainerClient mockContainerClient;
|
||||
|
||||
@Mock
|
||||
private BlobServiceClient mockBlobServiceClient;
|
||||
|
||||
@InjectMocks
|
||||
private MessageHandlerUtility<UsageDetail> messageHandlerUtility;
|
||||
|
||||
private Message<UsageDetail> messageToPublish;
|
||||
private MessageReference messageReference;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
System.setProperty("BlobStorageConnectionString", "https://www.dummyEndpoint.com/api/blobs");
|
||||
|
||||
var messageBody = new MessageBody<UsageDetail>();
|
||||
var usageDetailsList = new ArrayList<UsageDetail>();
|
||||
var random = new Random();
|
||||
for (int i = 0; i < 51; i++) {
|
||||
var usageDetail = new UsageDetail();
|
||||
usageDetail.setUserId("userId" + i);
|
||||
usageDetail.setData(random.nextInt(500));
|
||||
usageDetail.setDuration(random.nextInt(500));
|
||||
|
||||
usageDetailsList.add(usageDetail);
|
||||
}
|
||||
messageBody.setData(usageDetailsList);
|
||||
|
||||
// Create message header
|
||||
var messageHeader = new MessageHeader();
|
||||
messageHeader.setId(UUID.randomUUID().toString());
|
||||
messageHeader.setSubject("UsageDetailPublisher");
|
||||
messageHeader.setTopic("usagecostprocessorfunction-topic");
|
||||
messageHeader.setEventType("UsageDetail");
|
||||
messageHeader.setEventTime(OffsetDateTime.now().toString());
|
||||
this.messageReference = new MessageReference("callusageapp", messageHeader.getId() + "/input.json");
|
||||
messageHeader.setData(messageReference);
|
||||
messageHeader.setDataVersion("v1.0");
|
||||
|
||||
// Create entire message
|
||||
this.messageToPublish = new Message<>();
|
||||
this.messageToPublish.setMessageHeader(messageHeader);
|
||||
this.messageToPublish.setMessageBody(messageBody);
|
||||
|
||||
when(mockContainerClient.getBlobClient(anyString())).thenReturn(mockBlobClient);
|
||||
when(mockBlobServiceClient.getBlobContainerClient(anyString())).thenReturn(mockContainerClient);
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldDropMessageToPersistantStorage() {
|
||||
messageHandlerUtility.dropToPersistantStorage(messageToPublish, Logger.getLogger("logger"));
|
||||
verify(mockBlobServiceClient, times(1)).getBlobContainerClient(anyString());
|
||||
// verify(mockContainerClient, times(0)).exists();
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldReadMessageFromPersistantStorage() {
|
||||
|
||||
messageHandlerUtility.readFromPersistantStorage(messageReference, Logger.getLogger("logger"));
|
||||
verify(mockBlobServiceClient, times(1)).getBlobContainerClient(anyString());
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
mock-maker-inline
|
@ -0,0 +1,15 @@
|
||||
[
|
||||
{
|
||||
"data": {
|
||||
"validationCode": "C12F266E-79D9-4C0A-9922-5EF6201A34C2",
|
||||
"validationUrl": "https://rp-centralindia.eventgrid.azure.net:553/eventsubscriptions/usagedetailpublisherfunction-subscription/validate?idu003dC12F266E-79D9-4C0A-9922-5EF6201A34C2u0026tu003d2021-10-26T08:10:52.4999377Zu0026apiVersionu003d2020-10-15-previewu0026tokenu003d30kEVoL8rAOWzQv0buurhrKnbP%2bGMtHObbA%2bax6wb4Y%3d"
|
||||
},
|
||||
"dataVersion": "2",
|
||||
"eventTime": "2021-10-26T08:10:52.4999377Z",
|
||||
"eventType": "Microsoft.EventGrid.SubscriptionValidationEvent",
|
||||
"id": "e2a8466b-3dc0-46b7-bb7d-b999e51a2848",
|
||||
"metadataVersion": "1",
|
||||
"subject": "",
|
||||
"topic": "/subscriptions/0fef643d-a6b1-48f9-a256-53fbd0d22f48/resourceGroups/resource-group-ccp/providers/Microsoft.EventGrid/domains/event-grid-domains-ccp/topics/usagedetailpublisherfunction-topic"
|
||||
}
|
||||
]
|
@ -0,0 +1,15 @@
|
||||
[
|
||||
{
|
||||
"data": {
|
||||
"dataFileName": "d8284456-dfff-4bd4-9cef-ea99f70f4835/input.json",
|
||||
"dataLocation": "callusageapp"
|
||||
},
|
||||
"dataVersion": "v1.0",
|
||||
"eventTime": "2021-10-25T19:17:15.7468501Z",
|
||||
"eventType": "UsageDetail",
|
||||
"id": "d8284456-dfff-4bd4-9cef-ea99f70f4835",
|
||||
"metadataVersion": "1",
|
||||
"subject": "UsageDetailPublisher",
|
||||
"topic": "/subscriptions/0fef643d-a6b1-48f9-a256-ea99f70f4835/resourceGroups/resource-group-ccp/providers/Microsoft.EventGrid/domains/event-grid-domains-ccp/topics/usagecostprocessorfunction-topic"
|
||||
}
|
||||
]
|
BIN
cloud-claim-check-pattern/etc/Claim-Check-Pattern.png
Normal file
BIN
cloud-claim-check-pattern/etc/Claim-Check-Pattern.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 52 KiB |
117
cloud-claim-check-pattern/etc/claim-check-pattern.urm.puml
Normal file
117
cloud-claim-check-pattern/etc/claim-check-pattern.urm.puml
Normal file
@ -0,0 +1,117 @@
|
||||
@startuml
|
||||
class UsageDetailPublisherFunction [[java:com.iluwatar.producer.calldetails.functions]] {
|
||||
-messageHandlerUtility: MessageHandlerUtility<UsageDetail>
|
||||
-eventHandlerUtility: EventHandlerUtility<MessageHeader>
|
||||
+run(): HttpResponseMessage
|
||||
}
|
||||
|
||||
class UsageCostProcessorFunction [[java:com.iluwatar.consumer.callcostprocessor.functions]] {
|
||||
-messageHandlerUtilityForUsageDetail: MessageHandlerUtility<UsageDetail>
|
||||
-messageHandlerUtilityForUsageCostDetail: MessageHandlerUtility<UsageCostDetail>
|
||||
+run(): HttpResponseMessage
|
||||
}
|
||||
|
||||
class "MessageHandlerUtility<T>" as MessageHandlerUtility_T [[java:com.iluwatar.claimcheckpattern.utility]] {
|
||||
+readFromPersistantStorage(messageReference: MessageReference, logger: Logger): Message
|
||||
+dropToPersistantStorage(message: Message, logger: Logger): void
|
||||
}
|
||||
|
||||
class "EventHandlerUtility<T>" as EventHandlerUtility_T [[java:com.callusage.utility.PersistentLocalStorageUtility]] {
|
||||
+publishEvent(customEvent: T, logger: Logger): void
|
||||
}
|
||||
|
||||
class "Message<T>" as Message_T [[java:com.iluwatar.claimcheckpattern.domain]] {
|
||||
-messageHeader: MessageHeader
|
||||
-messageData: MessageData<T>
|
||||
+Message(messageHeader: MessageHeader, messageData: MessageData<T>)
|
||||
+getMessageData(): MessageData<T>
|
||||
+getMessageHeader(): MessageHeader
|
||||
}
|
||||
|
||||
|
||||
class MessageHeader [[java:com.iluwatar.claimcheckpattern.domain]] {
|
||||
-id: String
|
||||
-subject: String
|
||||
-topic: String
|
||||
-eventType: String
|
||||
-eventTime: String
|
||||
-data: Object
|
||||
-dataVersion: String
|
||||
+getId(): String
|
||||
+setId(id: String): void
|
||||
+getSubject(): String
|
||||
+setSubject(subject: String): void
|
||||
+getTopic(): String
|
||||
+setTopic(topic: String): void
|
||||
+getEventType(): String
|
||||
+setEventType(eventType: String): void
|
||||
+getEventTime(): String
|
||||
+setEventTime(eventTime: String): void
|
||||
+getData(): Object
|
||||
+setData(data: Object): void
|
||||
+getDataVersion(): String
|
||||
+setDataVersion(dataVersion:String): void
|
||||
|
||||
}
|
||||
|
||||
|
||||
class "MessageBody<T>" as MessageBody_T [[java:com.iluwatar.claimcheckpattern.domain]] {
|
||||
-data: List[] T
|
||||
+getData(): List[] T
|
||||
+setData(data:List[] T): void
|
||||
}
|
||||
|
||||
class MessageReference [[java:com.iluwatar.claimcheckpattern.domain]] {
|
||||
-dataLocation: String
|
||||
-dataFileName: String
|
||||
+getDataLocation(): String
|
||||
+setDataLocation(dataLocation:String): void
|
||||
+getDataFileName(): String
|
||||
+setDataFileName(dataFileName:String): void
|
||||
}
|
||||
|
||||
class UsageDetail [[java:com.iluwatar.claimcheckpattern.domain]] {
|
||||
-userId: String
|
||||
-duration: int
|
||||
-data: int
|
||||
+getUserId(): String
|
||||
+setUserId(userId: String): void
|
||||
+getDuration(): long
|
||||
+setDuration(duration: long): void
|
||||
+getData(): long
|
||||
+setData(data: long): void
|
||||
}
|
||||
|
||||
class UsageCostDetail [[java:com.iluwatar.claimcheckpattern.domain]] {
|
||||
-userId: String
|
||||
-callCost: double
|
||||
-dataCost: double
|
||||
+getUserId(): String
|
||||
+setUserId(userId: String): void
|
||||
+getCallCost(): double
|
||||
+setCallCost(callCost:double): void
|
||||
+getDataCost(): double
|
||||
+setDataCost(dataCost:double) : void
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Message_T "1" *-- "1" MessageHeader : has
|
||||
Message_T "1" *-- "1" MessageBody_T : has
|
||||
MessageHeader "1" *-- "1" MessageReference : has as data object
|
||||
MessageBody_T "1" *-- "1" UsageDetail: has
|
||||
MessageBody_T "1" *-- "1" UsageCostDetail: has
|
||||
|
||||
EventHandlerUtility_T "1" *-- "1" MessageHeader: has
|
||||
MessageHandlerUtility_T "1" *-- "1" Message_T: has
|
||||
|
||||
UsageDetailPublisherFunction "1" *-- "1" MessageHandlerUtility_T : has
|
||||
UsageDetailPublisherFunction "1" *-- "1" EventHandlerUtility_T : has
|
||||
|
||||
UsageCostProcessorFunction "1" *-- "1" MessageHandlerUtility_T : has
|
||||
UsageCostProcessorFunction "1" *-- "1" MessageHandlerUtility_T : has
|
||||
@enduml
|
BIN
cloud-claim-check-pattern/etc/class-diagram.png
Normal file
BIN
cloud-claim-check-pattern/etc/class-diagram.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 108 KiB |
69
cloud-claim-check-pattern/pom.xml
Normal file
69
cloud-claim-check-pattern/pom.xml
Normal file
@ -0,0 +1,69 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
The MIT License
|
||||
Copyright © 2014-2021 Ilkka Seppälä
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
-->
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
|
||||
<parent>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>claim-check-pattern</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<modules>
|
||||
<module>call-usage-app</module>
|
||||
</modules>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<version>2.8.8</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter</artifactId>
|
||||
<version>5.8.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-junit-jupiter</artifactId>
|
||||
<version>4.0.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-inline</artifactId>
|
||||
<version>4.0.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
@ -28,7 +28,7 @@
|
||||
<parent>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>collection-pipeline</artifactId>
|
||||
<dependencies>
|
||||
|
@ -28,7 +28,7 @@
|
||||
<parent>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>combinator</artifactId>
|
||||
<dependencies>
|
||||
|
@ -28,7 +28,7 @@
|
||||
<parent>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>command</artifactId>
|
||||
<dependencies>
|
||||
|
@ -28,7 +28,7 @@
|
||||
<parent>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>commander</artifactId>
|
||||
<dependencies>
|
||||
|
@ -27,7 +27,7 @@
|
||||
<parent>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>composite-entity</artifactId>
|
||||
|
@ -28,7 +28,7 @@
|
||||
<parent>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>composite</artifactId>
|
||||
<dependencies>
|
||||
|
@ -27,7 +27,7 @@
|
||||
<parent>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>converter</artifactId>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
@ -28,7 +28,7 @@
|
||||
<parent>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>cqrs</artifactId>
|
||||
<dependencies>
|
||||
|
@ -28,7 +28,7 @@
|
||||
<parent>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>dao</artifactId>
|
||||
<dependencies>
|
||||
|
@ -28,7 +28,7 @@
|
||||
<parent>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>data-bus</artifactId>
|
||||
<dependencies>
|
||||
|
@ -28,7 +28,7 @@
|
||||
<parent>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>data-locality</artifactId>
|
||||
<dependencies>
|
||||
|
@ -28,7 +28,7 @@
|
||||
<parent>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>data-mapper</artifactId>
|
||||
<dependencies>
|
||||
|
@ -28,7 +28,7 @@
|
||||
<parent>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>data-transfer-object</artifactId>
|
||||
<dependencies>
|
||||
|
@ -28,7 +28,7 @@
|
||||
<parent>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>decorator</artifactId>
|
||||
<dependencies>
|
||||
|
@ -27,7 +27,7 @@
|
||||
<parent>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>delegation</artifactId>
|
||||
|
@ -28,7 +28,7 @@
|
||||
<parent>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>dependency-injection</artifactId>
|
||||
<dependencies>
|
||||
|
@ -28,10 +28,10 @@
|
||||
<parent>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>dirty-flag</artifactId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
<name>dirty-flag</name>
|
||||
<url>http://maven.apache.org</url>
|
||||
<properties>
|
||||
|
@ -27,7 +27,7 @@
|
||||
<parent>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>domain-model</artifactId>
|
||||
|
@ -27,7 +27,7 @@
|
||||
<parent>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>double-buffer</artifactId>
|
||||
|
@ -27,7 +27,7 @@
|
||||
<parent>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>double-checked-locking</artifactId>
|
||||
<dependencies>
|
||||
|
@ -28,7 +28,7 @@
|
||||
<parent>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>double-dispatch</artifactId>
|
||||
<dependencies>
|
||||
|
@ -29,7 +29,7 @@
|
||||
<parent>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
@ -28,7 +28,7 @@
|
||||
<parent>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>eip-message-channel</artifactId>
|
||||
<dependencies>
|
||||
|
@ -28,7 +28,7 @@
|
||||
<parent>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>eip-publish-subscribe</artifactId>
|
||||
<dependencies>
|
||||
|
@ -29,7 +29,7 @@
|
||||
<parent>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
@ -29,7 +29,7 @@
|
||||
<parent>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
@ -28,7 +28,7 @@
|
||||
<parent>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>event-aggregator</artifactId>
|
||||
<dependencies>
|
||||
|
@ -28,7 +28,7 @@
|
||||
<parent>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>event-asynchronous</artifactId>
|
||||
<dependencies>
|
||||
|
@ -28,7 +28,7 @@
|
||||
<parent>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>event-driven-architecture</artifactId>
|
||||
<dependencies>
|
||||
|
@ -28,7 +28,7 @@
|
||||
<parent>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>event-queue</artifactId>
|
||||
<dependencies>
|
||||
|
@ -28,7 +28,7 @@
|
||||
<parent>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>event-sourcing</artifactId>
|
||||
<dependencies>
|
||||
|
@ -28,7 +28,7 @@
|
||||
<parent>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>execute-around</artifactId>
|
||||
<dependencies>
|
||||
|
@ -27,7 +27,7 @@
|
||||
<parent>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>extension-objects</artifactId>
|
||||
|
@ -28,7 +28,7 @@
|
||||
<parent>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>facade</artifactId>
|
||||
<dependencies>
|
||||
|
@ -28,7 +28,7 @@
|
||||
<parent>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>factory-kit</artifactId>
|
||||
<dependencies>
|
||||
|
@ -28,7 +28,7 @@
|
||||
<parent>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>factory-method</artifactId>
|
||||
<dependencies>
|
||||
|
@ -41,6 +41,8 @@ import lombok.extern.slf4j.Slf4j;
|
||||
@Slf4j
|
||||
public class App {
|
||||
|
||||
private static final String MANUFACTURED = "{} manufactured {}";
|
||||
|
||||
/**
|
||||
* Program entry point.
|
||||
* @param args command line args
|
||||
@ -49,14 +51,14 @@ public class App {
|
||||
|
||||
Blacksmith blacksmith = new OrcBlacksmith();
|
||||
Weapon weapon = blacksmith.manufactureWeapon(WeaponType.SPEAR);
|
||||
LOGGER.info("{} manufactured {}", blacksmith, weapon);
|
||||
LOGGER.info(MANUFACTURED, blacksmith, weapon);
|
||||
weapon = blacksmith.manufactureWeapon(WeaponType.AXE);
|
||||
LOGGER.info("{} manufactured {}", blacksmith, weapon);
|
||||
LOGGER.info(MANUFACTURED, blacksmith, weapon);
|
||||
|
||||
blacksmith = new ElfBlacksmith();
|
||||
weapon = blacksmith.manufactureWeapon(WeaponType.SPEAR);
|
||||
LOGGER.info("{} manufactured {}", blacksmith, weapon);
|
||||
LOGGER.info(MANUFACTURED, blacksmith, weapon);
|
||||
weapon = blacksmith.manufactureWeapon(WeaponType.AXE);
|
||||
LOGGER.info("{} manufactured {}", blacksmith, weapon);
|
||||
LOGGER.info(MANUFACTURED, blacksmith, weapon);
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
<parent>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>factory</artifactId>
|
||||
<dependencies>
|
||||
|
@ -31,7 +31,7 @@
|
||||
<parent>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>fanout-fanin</artifactId>
|
||||
|
@ -27,7 +27,7 @@
|
||||
<parent>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>feature-toggle</artifactId>
|
||||
|
@ -27,7 +27,7 @@
|
||||
<parent>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>filterer</artifactId>
|
||||
|
@ -27,7 +27,7 @@
|
||||
<parent>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>fluentinterface</artifactId>
|
||||
|
@ -28,7 +28,7 @@
|
||||
<parent>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<version>1.25.0-SNAPSHOT</version>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>flux</artifactId>
|
||||
<dependencies>
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user