full_name stringlengths 7 104 | description stringlengths 4 725 ⌀ | topics stringlengths 3 468 ⌀ | readme stringlengths 13 565k ⌀ | label int64 0 1 |
|---|---|---|---|---|
frandorado/spring-projects | Spring examples | java spring spring-boot spring-mvc | # Spring projects
* `Mar 20` **Spring Actuator (Micrometer) Undertow** Undertow metrics with Spring Actuator [Link to the project](https://github.com/frandorado/spring-projects/tree/master/spring-micrometer-undertow) and [Link to the blog](https://frandorado.github.io/spring/2020/03/31/spring-actuator-undertow.html)
* `Feb 20` **Custom deserialization in Spring** Custom deserialization using Jackson [Link to the project](https://github.com/frandorado/spring-projects/tree/master/spring-custom-serializer-deserializer) and [Link to the blog](https://frandorado.github.io/spring/2020/02/14/spring-custom-json-transforms.html)
* `Sep 19` **Spring Batch AWS Integration** Integration of Spring Batch with AWS SQS for remote chunking and partitioning. [Link to the project](https://github.com/frandorado/spring-projects/tree/master/spring-batch-aws-integration) and [Link to the blog](https://frandorado.github.io/spring/2019/07/29/spring-batch-aws-series-introduction.html)
* `Jun 19` **Reactive vs Non-Reactive Spring Performance** Comparation of performance between Spring MVC and Spring WebFlux. [Link to the project](https://github.com/frandorado/spring-projects/tree/master/spring-reactive-nonreactive) and [Link to the blog](https://frandorado.github.io/spring/2019/06/26/spring-reactive-vs-non-reactive-performance.html)
* `Apr 19` **Spring Data Mongo using Mongo Cluster** Spring Data Mongo using a configured Cluster with Docker. [Link to the project](https://github.com/frandorado/spring-projects/tree/master/spring-data-mongo-with-cluster) and [Link to the blog](https://frandorado.github.io/spring/2019/04/16/mongo-cluster-with-spring-data-mongo.html)
* `Jan 19` **Circuit Breaker with Resilience4j and Spring** Example of Circuit Breaker in Spring using Reslience4j library. [Link to the project](https://github.com/frandorado/spring-projects/tree/master/resilience4j-spring) and [Link to the blog](https://frandorado.github.io/spring/2019/01/04/circuitbreaker-resilience4j-spring.html)
* `Dec 18` **AsyncRestTemplate returns 404 (Site Not Found) with Apache factory** Spring Boot Web Application where we change the default implementation of Spring's factory for AsyncRestTemplate with the Apache's factory and the error 404 found. [Link to the project](https://github.com/frandorado/spring-projects/tree/master/async-rest-template-apache) and [Link to the blog](https://frandorado.github.io/spring/2018/12/17/asyncresttemplate-apache-404.html)
* `Nov 18` **Logging of Requests and Responses in Spring (including body)** Spring Boot Web Application where we trace in logs the request and the response including the body. [Link to the project](https://github.com/frandorado/spring-projects/tree/master/log-request-response-with-body) and [Link to the blog](https://frandorado.github.io/spring/2018/11/15/log-request-response-with-body-spring.html)
* `Nov 18` **Logging of Requests and Responses in Spring with Undertow (no body)** Spring Boot Web Application where we configure Undertow as embedded server and enable RequestDumpingHandler to log requests and responses. [Link to the project](https://github.com/frandorado/spring-projects/tree/master/log-request-response-undertow) and [Link to the blog](https://frandorado.github.io/spring/2018/11/04/log-request-response-with-undertow-spring.html)
| 0 |
kylinsoong/drools-examples | Drools 中文文档 | null | null | 0 |
asciidoctor/asciidoctor-gradle-examples | A collection of example projects that demonstrates how to use the Asciidoctor Gradle plugin | null | null | 1 |
vladmihalcea/high-performance-java-persistence | The High-Performance Java Persistence book and video course code examples | null | # High-Performance Java Persistence
The [High-Performance Java Persistence](https://vladmihalcea.com/books/high-performance-java-persistence?utm_source=GitHub&utm_medium=banner&utm_campaign=hpjp) book and video course code examples. I wrote [this article](https://vladmihalcea.com/high-performance-java-persistence-github-repository/) about this repository since it's one of the best way to test JDBC, JPA, Hibernate or even jOOQ code. Or, if you prefer videos, you can watch [this presentation on YouTube](https://www.youtube.com/watch?v=U8MoOe8uMYA).
### Are you struggling with application performance issues?
<a href="https://vladmihalcea.com/hypersistence-optimizer/?utm_source=GitHub&utm_medium=banner&utm_campaign=hpjp">
<img src="https://vladmihalcea.com/wp-content/uploads/2019/03/Hypersistence-Optimizer-300x250.jpg" alt="Hypersistence Optimizer">
</a>
Imagine having a tool that can automatically detect if you are using JPA and Hibernate properly. No more performance issues, no more having to spend countless hours trying to figure out why your application is barely crawling.
Imagine discovering early during the development cycle that you are using suboptimal mappings and entity relationships or that you are missing performance-related settings.
More, with Hypersistence Optimizer, you can detect all such issues during testing and make sure you don't deploy to production a change that will affect data access layer performance.
[Hypersistence Optimizer](https://vladmihalcea.com/hypersistence-optimizer/?utm_source=GitHub&utm_medium=banner&utm_campaign=hpjp) is the tool you've been long waiting for!
#### Training
If you are interested in on-site training, I can offer you my [High-Performance Java Persistence training](https://vladmihalcea.com/trainings/?utm_source=GitHub&utm_medium=banner&utm_campaign=hpjp)
which can be adapted to one, two or three days of sessions. For more details, check out [my website](https://vladmihalcea.com/trainings/?utm_source=GitHub&utm_medium=banner&utm_campaign=hpjp).
#### Consulting
If you want me to review your application and provide insight into how you can optimize it to run faster,
then check out my [consulting page](https://vladmihalcea.com/consulting/?utm_source=GitHub&utm_medium=banner&utm_campaign=hpjp).
#### High-Performance Java Persistence Video Courses
If you want the fastest way to learn how to speed up a Java database application, then you should definitely enroll in [my High-Performance Java Persistence video courses](https://vladmihalcea.com/courses/?utm_source=GitHub&utm_medium=banner&utm_campaign=hpjp).
#### High-Performance Java Persistence Book
Or, if you prefer reading books, you are going to love my [High-Performance Java Persistence book](https://vladmihalcea.com/books/high-performance-java-persistence?utm_source=GitHub&utm_medium=banner&utm_campaign=hpjp) as well.
<a href="https://vladmihalcea.com/books/high-performance-java-persistence?utm_source=GitHub&utm_medium=banner&utm_campaign=hpjp">
<img src="https://i0.wp.com/vladmihalcea.com/wp-content/uploads/2018/01/HPJP_h200.jpg" alt="High-Performance Java Persistence book">
</a>
<a href="https://vladmihalcea.com/courses?utm_source=GitHub&utm_medium=banner&utm_campaign=hpjp">
<img src="https://i0.wp.com/vladmihalcea.com/wp-content/uploads/2018/01/HPJP_Video_Vertical_h200.jpg" alt="High-Performance Java Persistence video course">
</a>
## Java
All examples require at least Java 17 because of the awesome [Text Blocks](https://openjdk.java.net/jeps/355) feature, which makes JPQL and SQL queries so much readable.
## Maven
You need to use Maven 3.6.2 or newer to build the project.
## IntelliJ IDEA
On IntelliJ IDEA, the project runs just fine. You will have to make sure to select Java 17 or newer.
## Database setup
The project uses various database systems for integration testing, and you can configure the JDBC connection settings using the
`DatasourceProvider` instances (e.g., `PostgreSQLDataSourceProvider`).
By default, without configuring any database explicitly, HSQLDB is used for testing.
However, since some integration tests are designed to work on specific relational databases, we will need to have those databases started prior to running those tests.
Therefore, when running a DB-specific test, this GitHub repository will execute the following steps:
1. First, the test will try to find whether there's a local RDBMS it can use to run the test.
2. If no local database is found, the integration tests will use Testcontainers to bootstrap a Docker container
with the required *Oracle*, *SQL Server*, *PostgreSQL*, *MySQL*, *MariaDB*, *YugabyteDB*, or *CockroachDB* instance on demand.
> While you don't need to install any database manually on your local OS, this is recommended since your tests will run much faster than if they used Testcontainers.
### Manual Database configuration
- PostgreSQL
You can install PostgreSQL, and the password for the `postgres` user should be `admin`.
Now you need to create a `high_performance_java_persistence` database.
- Oracle
You need to download and install Oracle XE
Set the `sys` password to `admin`
Connect to Oracle using the "sys as sysdba" user and create a new user:
alter session set "_ORACLE_SCRIPT"=true;
create user oracle identified by admin default tablespace users;
grant dba to oracle;
alter system set processes=1000 scope=spfile;
alter system set sessions=1000 scope=spfile;
ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;
Open the `C:\app\${user.name}\product\21c\homes\OraDB21Home1\network\admin` folder where `${user.name}` is your current Windows username.
Locate the `tnsnames.ora` and `listener.ora` files and change the port from `1522` to `1521` if that's the case. If you made these modifications,
you need to restart the `OracleOraDB21Home1TNSListener` and `OracleServiceXE` Windows services.
- MySQL
You should install MySQL 8, and the password for the `mysql` user should be `admin`.
Now, you need to create a `high_performance_java_persistence` schema
Besides having all privileges on this schema, the `mysql` user also requires select permission on `mysql.PROC`.
If you don't have a `mysql` user created at database installation time, you can create one as follows:
````
CREATE USER 'mysql'@'localhost';
SET PASSWORD for 'mysql'@'localhost'='admin';
GRANT ALL PRIVILEGES ON high_performance_java_persistence.* TO 'mysql'@'localhost';
GRANT SELECT ON mysql.* TO 'mysql'@'localhost';
FLUSH PRIVILEGES;
````
- SQL Server
You can install SQL Server Express Edition with Tools. Choose mixed mode authentication and set the `sa` user password to `adm1n`.
Open SQL Server Configuration Manager -> SQL Server Network Configuration and enable Named Pipes and TCP
In the right pane of the TCP/IP option, choose Properties, then IP Addresses and make sure you Enable all listed IP addresses.
You need to blank the dynamic TCP port value and configure the static TCP port 1433 for all IPs.
Open SQL Server Management Studio and create the `high_performance_java_persistence` database
## Maven
> To build the project, don't use *install* or *package*. Instead, just compile test classes like this:
>
> mvnw clean test-compile
Or you can just run the `build.bat` or `build.sh` scripts which run the above Maven command.
Afterward, just pick one test from the IDE and run it individually.
> Don't you run all tests at once (e.g. `mvn clean test`) because the test suite will take a very long time to complete.
>
> So, run the test you are interested in individually.
Enjoy learning more about Java Persistence, Hibernate, and database systems!
| 0 |
eventuate-examples/eventuate-examples-java-customers-and-orders | Java version of the Customers and Orders event sourcing example from my presentations | null | This is the Java version of the customers and orders example that I've used in numerous presentations
on developing microservices with event sourcing and CQRS.
The code is built using the Eventuate platform.
It illustrates how to implement an eventually consistent credit limit check using event sourcing.
For more information, see this [presentation from Gluecon 2016](http://www.slideshare.net/chris.e.richardson/a-pattern-language-for-microservices-gluecon-2016/24)
# About Eventuate™

The application is built using [Eventuate](http://eventuate.io/), which is an application platform for writing transactional microservices.
It provides a simple yet powerful event-driven programming model that is based on event sourcing and Command Query Responsibility Segregation (CQRS).
Eventuate solves the distributed data management problems inherent in a microservice architecture.
It consists of a scalable, distributed event store and client libraries for various languages and frameworks including Java, Scala, and the Spring framework.
# Building and running the application.
This is a Java 8, Gradle project. However, you do not need to install Gradle since it will be downloaded automatically. You just need to have Java 8 installed.
## Building and running using Eventuate Local
First, build the application:
```
./gradlew assemble
```
Next, you can launch the application using [Docker Compose](https://docs.docker.com/compose/)
Note:
If the containers aren't accessible via `localhost` - e.g. you are using Docker Toolbox, you will have to use `${DOCKER_HOST_IP}` instead of localhost.
See this http://eventuate.io/docs/usingdocker.html[guide to setting `DOCKER_HOST_IP`] for more information.
```
./gradlew <database-mode>ComposeBuild
./gradlew <database-mode>ComposeUp
```
Where `database-mode` is one of:
* `mysqlbinlog` - use MySQL with Binlog-based event publishing
* `postgreswal` - use Postgres with Postgres WAL-based event publishing
* `postgrespolling` - use Postgres with generic JDBC polling-based event publishing
Finally, you can use the Swagger UI provided by the services to create customers and orders, and view the order history:
* `http://localhost:8081/swagger-ui.html` - Create a customer
* `http://localhost:8083/swagger-ui.html` - Create an order
* `http://localhost:8082/swagger-ui.html` - View the customer and the order
(Hint: best to open these URLs in separate tabs)
The script `./show-urls.sh` will display the URLs.
| 1 |
mongodb/stitch-examples | MongoDB Stitch Examples | null | # MongoDB Stitch Examples
| Documentation |
| ---------------------------------------------------------------------------------------------- |
| [blog-comments-simple](https://docs.mongodb.com/stitch/getting-started/first-stitch-app/) |
| [ToDo (Web)](https://docs.mongodb.com/stitch/getting-started/todo-web/) |
| [ToDo (Android)](https://docs.mongodb.com/stitch/getting-started/todo-android/) |
| [ToDo (iOS)](https://docs.mongodb.com/stitch/getting-started/todo-ios/) |
| [Dashboard](https://docs.mongodb.com/stitch/getting-started/dashboard/) |
| [IoT Temperature Tracker](https://docs.mongodb.com/stitch/getting-started/temperature-tracker/)|
[](https://gitter.im/mongodb/stitch?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
| 0 |
ihuaylupo/manning-smia | Spring Microservices in Action - Second Edition - Code Examples | null | null | 0 |
eventuate-tram/eventuate-tram-sagas-examples-customers-and-orders | Spring Boot/JPA microservices that use an orchestration-based saga to maintain data consistency | null | null | 0 |
jeffheaton/encog-java-examples | null | null | [](https://travis-ci.org/encog/encog-java-examples)
Encog Examples 3.3
The following links will be helpful getting started with Encog.
Getting Started:
http://www.heatonresearch.com/wiki/Getting_Started
Important Links:
http://www.heatonresearch.com/encog
http://www.heatonresearch.com/wiki | 0 |
yidongnan/spring-cloud-netflix-example | spring-cloud-netflix-example is an example for microservices system | docker microservice rabbitmq spring-boot-admin spring-cloud-config spring-cloud-netflix spring-cloud-sleuth swagger zipkin | # Spring Cloud Netflix Sample Application
<details>
<summary>Translations:</summary>
- [Chinese / 中文](README-zh.md)
</details>
spring-cloud-netflix-example is an example for microservices system.
It contains **configuration management, service discovery, circuit breakers, intelligent routing, distributed tracing, application monitor**.
The registry center uses the eureka, if you want to use consul, you can refer to https://github.com/yidongnan/spring-cloud-consul-example.
## Getting Started
```shell
./gradlew clean build -x test
./buildDockerImage.sh
docker-compose up -d
```
If you want to start more serve, you should use:
```shell
docker-compose scale service-a=2 service-b=3
```
Start the basic service in the development environment:
```
docker-compose -f docker-compose-dev.yml up -d
```
## Technology List
* Spring Cloud Netflix
* Spring Cloud Sleuth
* Spring Cloud Config
* Spring Boot Admin
* Spring Boot
* ZipKin
* RabbitMQ
* Docker
* Swagger
## Architecture Overview
[](url "title")
<img src="https://raw.githubusercontent.com/yidongnan/spring-cloud-netflix-example/master/screenshots/Architecture.png">
## Screenshots
### Api Route(Zuul)
[](url "title")
<img src="https://raw.githubusercontent.com/yidongnan/spring-cloud-netflix-example/master/screenshots/Selection_001.png">
### Eureka Dashboard
[](url "title")
<img src="https://raw.githubusercontent.com/yidongnan/spring-cloud-netflix-example/master/screenshots/Selection_002.png">
### ZipKin Dashboard
[](url "title")
<img src="https://raw.githubusercontent.com/yidongnan/spring-cloud-netflix-example/master/screenshots/Selection_003.png">
### ZipKin Trace Detail
[](url "title")
<img src="https://raw.githubusercontent.com/yidongnan/spring-cloud-netflix-example/master/screenshots/Selection_004.png">
### ZipKin Dependencies Overview
[](url "title")
<img src="https://raw.githubusercontent.com/yidongnan/spring-cloud-netflix-example/master/screenshots/Selection_005.png">
### Spring Boot Admin Dashboard
[](url "title")
<img src="https://raw.githubusercontent.com/yidongnan/spring-cloud-netflix-example/master/screenshots/Selection_006.png">
### Spring Boot Admin Detail
[](url "title")
<img src="https://raw.githubusercontent.com/yidongnan/spring-cloud-netflix-example/master/screenshots/Selection_007.png">
### Spring Boot Admin Environment
[](url "title")
<img src="https://raw.githubusercontent.com/yidongnan/spring-cloud-netflix-example/master/screenshots/Selection_008.png">
### Spring Boot Admin Thread Dump
[](url "title")
<img src="https://raw.githubusercontent.com/yidongnan/spring-cloud-netflix-example/master/screenshots/Selection_009.png">
### Spring Boot Admin Trace
[](url "title")
<img src="https://raw.githubusercontent.com/yidongnan/spring-cloud-netflix-example/master/screenshots/Selection_010.png">
### Hystrix Dashboard
[](url "title")
<img src="https://raw.githubusercontent.com/yidongnan/spring-cloud-netflix-example/master/screenshots/Selection_011.png">
### Hystrix Dashboard Detail
[](url "title")
<img src="https://raw.githubusercontent.com/yidongnan/spring-cloud-netflix-example/master/screenshots/Selection_012.png">
| 1 |
jjohannes/understanding-gradle | The Understanding Gradle video series introduces the concepts of the Gradle Build Tool one-by-one in short videos. | examples gradle tutorial | null | 0 |
knowledgefactory4u/KnowledgeFactory | Spring examples | actuator crud-application java jparepository kotlin mongodb mongodb-database mysql-database reactive-programming spring-boot springmvc-mybatis thymeleaf webflux | # Spring Boot examples
# Local setup
Step 1: Download or clone the source code from GitHub to the local machine
Step 2: ```mvn clean install```
Step 3: ```mvn spring-boot:run``` or Run as Java Application
| 0 |
BruceEckel/AtomicKotlinExamples | Examples auto-extracted from the book Atomic Kotlin."" | kotlin kotlin-language kotlin-learning | # Atomic Kotlin Examples
If you want to experiment with the code examples from the book [Atomic
Kotlin](https://www.AtomicKotlin.com), you're in the right place.
These examples are automatically extracted directly from the book. This repository
includes tests to verify that the code in the book is correct.
> **NOTE** If you are planning to solve the exercises after reading each atom
> (and you should), you can get the exercises AND all these examples together by
> installing [the educational course](https://www.atomickotlin.com/exercises/).
> If you're going to solve the exercises, you can just install the course and you
> don't need to install the examples from this repository.
## Contents
- [Introduction](#introduction)
- [Compiling and Running Programs in IntelliJ IDEA](#compiling-and-running-programs-in-intellij-idea)
- [Building From the Command Line: Quick Version](#building-from-the-command-line-quick-version)
- [Building From the Command Line: Detailed Instructions](#building-from-the-command-line-detailed-instructions)
* [Install Java](#install-java)
+ [Windows](#windows)
+ [Macintosh](#macintosh)
+ [Linux](#linux)
* [Verify Your Installation](#verify-your-installation)
* [Installing and Running the Book Examples](#installing-and-running-the-book-examples)
- [Appendix A: Command-Line Basics](#appendix-a-command-line-basics)
* [Editors](#editors)
* [The Shell](#the-shell)
+ [Starting a Shell](#starting-a-shell)
+ [Directories](#directories)
+ [Basic Shell Operations](#basic-shell-operations)
+ [Unpacking a Zip Archive](#unpacking-a-zip-archive)
- [Appendix B: Command-Line Hello World](#appendix-b-command-line-hello-world)
* [Packages](#packages)
- [Appendix C: The Kotlin REPL](#appendix-c-the-kotlin-repl)
* [Install Kotlin](#install-kotlin)
* [The REPL](#the-repl)
- [Appendix D: Testing](#appendix-d-testing)
# Introduction
The easiest way to access and experiment with the book examples is to
clone/download this repository and open it with IntelliJ IDEA. This is all that
most people need, and those people can ignore the rest of this README.
The remainder of this README shows you how to build and test the examples using
both IntelliJ IDEA and the command line.
Exercises and solutions for the book can be found at
[AtomicKotlin.com/exercises](https://www.atomickotlin.com/exercises).
**Note**: If any terminology or processes described here are still not clear to
you, you can usually find explanations or answers through
[Google](https://www.google.com/). For more specific issues or problems, try
[StackOverflow](http://stackoverflow.com/). Sometimes you can find installation
instructions on [YouTube](https://www.youtube.com/).
# Compiling and Running Programs in IntelliJ IDEA
The easiest and fastest way to start using the examples in this book is by
compiling and running them using IntelliJ IDEA:
1. Follow the instructions [here](https://www.jetbrains.com/help/idea/installation-guide.html)
to install IntelliJ IDEA.
2. Download the [zipped code
repository](https://github.com/BruceEckel/AtomicKotlinExamples/archive/master.zip)
and [unzip it](#unpacking-a-zip-archive).
3. Start IntelliJ IDEA and select the `File | Open` menu item. Navigate to
where you unzipped the repository and open the `build.gradle` file. You should
see a dialog box like this:

Select the `Open as Project` button.
4. If you don't see a `Project` window on the left side, go to the menu and select
`View | Tool Windows | Project` to turn it on.
5. You'll see an `Examples` folder. Click on it to open it, then navigate to
the `HelloWorld` folder and open that, then double-click on `HelloWorld.kt`.
You'll see something like this:

Click on the green triangle in the gutter area to the left of `fun main() {`.
It should look like this:

Select the top one, the `Run` option, and IntelliJ IDEA will run your
program and display the resulting output.
**NOTE**: The first program you run will take awhile, because IntelliJ IDEA
is building the entire project. Subsequent programs will start much more
quickly.
6. If you don't already have a JDK (*Java Development Kit*) on your machine,
you will see error messages. A JDK is necessary to compile both Java and
Kotlin. You can [install one from within
IntelliJ](https://www.jetbrains.com/help/idea/sdk.html#jdk-from-ide). Once the
JDK is installed, IDEA will also be able to compile Kotlin.
# Building From the Command Line: Quick Version
Before you can run the examples from this repository, you must install the
current version of
[Java](http://www.oracle.com/technetwork/java/javase/downloads/index.html),
although some earlier versions should also work. (If you get any errors, try
upgrading to a more recent version of Java).
If you just want to download and check the code, [Download
Here](https://github.com/BruceEckel/AtomicKotlinExamples/archive/master.zip)
and [unzip it](#unpacking-a-zip-archive) into your destination directory. Open
a [shell/command window](#appendix-a-command-line-basics) and move into the
root of that directory. You'll know you are in the right directory if you see
the files `gradlew` and `gradlew.bat`.
You'll need an Internet connection the first time you compile the code,
because Gradle needs to first install itself, then all the support libraries.
Once these are installed you can perform additional compiling and running
offline.
On Mac/Linux, enter:
```
./gradlew test
```
(If you get a *Permission denied* error, run `chmod +x ./gradlew`)
On Windows, enter
```
gradlew test
```
If all goes well, the tests will run. Everything should complete without errors.
All the book examples are in the subdirectory `Examples` in subdirectories
corresponding to the atom names.
To compile and run examples using the Kotlin command-line tools, see
[Command-Line Hello World](#appendix-b-command-line-hello-world).
# Building From the Command Line: Detailed Instructions
If you are not familiar with the command line, first read [Command-Line
Basics](#appendix-a-command-line-basics).
## Install Java
Kotlin runs on top of Java, so you must first install the *Java Development Kit* (JDK).
### Windows
1. Follow the instructions to [install Chocolatey](https://chocolatey.org/).
2. At a [shell prompt](#appendix-a-command-line-basics), type: `choco install
jdk8` (you may also select a more recent version, like `jdk11`). The
installation process takes some time, but when it's finished Java is installed
and the necessary environment variables are set.
### Macintosh
The Mac comes with a much older version of Java that won't work for the
examples in this book, so you'll need to update it to (at least) Java 8.
1. Follow the instructions at this link to [Install HomeBrew](http://brew.sh/)
2. At a [shell prompt](#appendix-a-command-line-basics), first type
`brew update`. When that completes, enter `brew cask install java`.
**NOTE:** Sometimes the default version of Java that you get with the above
installation will be too recent and not validated by the Mac's security
system. If this happens you'll either need to turn off the security by hand
or install an earlier version of Java. For either choice, you'll need to Google
for answers on how to solve the problem (often the easiest approach is to just
search for the error message produced by the Mac).
### Linux
Use the standard package installer with the following [shell commands](#appendix-a-command-line-basics):
*Ubuntu/Debian*:
1. `sudo apt-get update`
2. `sudo apt-get install default-jdk`
*Fedora/Redhat*:
```
su -c "yum install java-1.8.0-openjdk"
```
## Verify Your Installation
[Open a new shell](#appendix-a-command-line-basics) and type:
```
java -version
```
You should see something like the following (Version numbers and actual text
will vary):
```
openjdk version "11" 2018-09-25
OpenJDK Runtime Environment 18.9 (build 11+28)
OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode)
```
If you see a message that the command is not found or not recognized, review
the installation instructions. If you still can't get it to work, check
[StackOverflow](http://stackoverflow.com/search?q=installing+java).
## Installing and Running the Book Examples
Once you have Java installed, the process to install and run the book examples
is the same for all platforms:
1. Download the book examples from the
[GitHub Repository](https://github.com/BruceEckel/AtomicKotlinExamples/archive/master.zip).
2. [Unzip](#unpacking-a-zip-archive) the downloaded file into the directory of your choice.
3. Use the Windows Explorer, the Mac Finder, or Nautilus or equivalent on Linux
to browse to the directory where you uzipped `AtomicKotlinExamples`, and
[open a shell](#appendix-a-command-line-basics) there.
4. If you're in the right directory, you should see files named `gradlew` and
`gradlew.bat` in that directory, along with numerous other files and
directories. The directories correspond to the chapters in the book.
5. At the shell prompt, type `gradlew test` (Windows) or `./gradlew test`
(Mac/Linux).
The first time you do this, Gradle will install itself and numerous other
packages, so it will take some time. After everything is installed, subsequent
builds and runs will be much faster.
Note that you must be connected to the Internet the first time you run `gradlew`
so that Gradle can download the necessary packages.
# Appendix A: Command-Line Basics
Because it is possible for a "dedicated beginner" to learn programming from
this book, you may not have previously used your computer's command-line shell.
If you have, you can go directly to the
[installation instructions](#building-from-the-command-line-detailed-instructions).
## Editors
To create and modify Kotlin program files—the code listings shown in this
book—you need a program called an *editor*. You'll also need the editor to
make changes to your system configuration files, which is sometimes required
during installation.
Programming editors vary from heavyweight *Integrated Development Environments*
(IDEs, like Eclipse, NetBeans and IntelliJ IDEA) to more basic text
manipulation applications. If you already have an IDE and are comfortable with
it, feel free to use that for this book.
Numerous explanations in this book are specific to IntelliJ IDEA so if you
don't already have an IDE you might as well start with IDEA. There are many
other editors; these are a subculture unto themselves and people sometimes get
into heated arguments about their merits. If you find one you like better, it's
not too hard to change. The important thing is to choose one and get
comfortable with it.
## The Shell
If you haven't programmed before, you might be unfamiliar with your operating
system *shell* (also called the *command prompt* in Windows). The shell harkens
back to the early days of computing when everything happened by typing commands
and the computer responded by displaying responses—everything was text-based.
Although it can seem primitive in the age of graphical user interfaces, a shell
provides a surprising number of valuable features.
To learn more about your shell than we cover here, see
[Bash Shell](https://en.wikipedia.org/wiki/Bash_(Unix_shell)) for Mac/Linux
or [Windows Shell](https://en.wikipedia.org/wiki/Windows_shell).
### Starting a Shell
**Mac**: Click on the *Spotlight* (the magnifying-glass icon in the upper-right
corner of the screen) and type "terminal." Click on the application that looks
like a little TV screen (you might also be able to hit "Return"). This starts a
shell in your home directory.
**Windows**: First, start the Windows Explorer to navigate through your
directories:
- *Windows 7*: click the "Start" button in the lower left corner of the screen.
In the Start Menu search box area type "explorer" and then press the "Enter"
key.
- *Windows 8*: click Windows+Q, type "explorer" and then press the "Enter" key.
- *Windows 10*: click Windows+E.
Once the Windows Explorer is running, move through the folders on your computer
by double-clicking on them with the mouse. Navigate to the desired folder. Now
click the file tab at the top left of the Explorer window and select "Open
Windows Powershell." This opens a shell in the destination directory.
**Linux**: To open a shell in your home directory:
- *Debian*: Press Alt+F2. In the dialog that pops up, type 'gnome-terminal'
- *Ubuntu*: Either right-click on the desktop and select 'Open Terminal', or
press Ctrl+Alt+T
- *Redhat*: Right-click on the desktop and select 'Open Terminal'
- *Fedora*: Press Alt+F2. In the dialog that pops up, type 'gnome-terminal'
### Directories
*Directories* are one of the fundamental elements of a shell. Directories hold
files, as well as other directories. Think of a directory as a tree with
branches. If `books` is a directory on your system and it has two other
directories as branches, for example `math` and `art`, we say that you have a
directory `books` with two *subdirectories* `math` and `art`. We refer to them
as `books/math` and `books/art` since `books` is their *parent* directory.
Note that Windows uses backslashes rather than forward slashes to separate the
parts of a directory.
### Basic Shell Operations
The shell operations shown here are approximately identical across operating
systems. For the purposes of this book, here are the essential operations in a
shell:
- **Change directory**: Use `cd` followed by the name of the
directory where you want to move, or `cd ..` if you want to move
up a directory. If you want to move to a different directory while
remembering where you came from, use `pushd` followed by the different
directory name. Then, to return to the previous directory, just say
`popd`.
- **Directory listing**: `ls` (`dir` in Windows) displays all the files and
subdirectory names in the current directory. Use the wildcard `*` (asterisk) to
narrow your search. For example, if you want to list all the files ending in
".kt," you say `ls *.kt` (Windows: `dir *.kt`). If you want to list the
files starting with "F" and ending in ".kt," you say `ls F*.kt` (Windows:
`dir F*.kt`).
- **Create a directory**: use the `mkdir` ("make directory") command
(Windows: `md`), followed by the name of the directory you want to create.
For example, `mkdir books` (Windows: `md books`).
- **Remove a file**: Use `rm` ("remove") followed by the name of the file
you wish to remove (Windows: `del`). For example, `rm somefile.kt` (Windows:
`del somefile.kt`).
- **Remove a directory**: use the `rm -r` command to remove the files in
the directory and the directory itself (Windows: `deltree`). For example,
`rm -r books` (Windows: `deltree books`).
- **Repeat a command**: The "up arrow" on all three operating
systems moves through previous commands so you can edit and
repeat them. On Mac/Linux, `!!` repeats the last command and
`!n` repeats the nth command.
- **Command history**: Use `history` in Mac/Linux or press the F7 key in Windows.
This gives you a list of all the commands you've entered. Mac/Linux provides
numbers to refer to when you want to repeat a command.
### Unpacking a Zip Archive
A file name ending with `.zip` is an archive containing other files in a
compressed format. Both Linux and Mac have command-line `unzip` utilities, and
it's possible to install a command-line `unzip` for Windows via the Internet.
However, in all three systems the graphical file browser (Windows Explorer, the
Mac Finder, or Nautilus or equivalent on Linux) will browse to the directory
containing your zip file. Then right-mouse-click on the file and select "Open"
on the Mac, "Extract Here" on Linux, or "Extract all ..." on Windows.
# Appendix B: Command-Line Hello World
This appendix explains how to compile and run the program shown in the "Hello
World" atom in the book, using the latest version (1.5 or higher) of the
[Kotlin command-line compiler](http://kotlinlang.org/docs/tutorials/command-line.html).
Open up a console window in the `HelloWorld` directory, where you'll see
`HelloWorld.kt`, and type:
```
kotlinc HelloWorld.kt
```
`kotlinc` means "Kotlin compiler." The compiler is the program that takes
your program and turns it into something that will run; this process is
called *compiling*.
Assuming you've typed the code correctly, you should get back the console
prompt, with no other messages. If you get error messages, try to discover
where you've mis-typed the code, correct it and try again. Once you are
successful, you're ready to run the program.
There's one more thing: When you run `kotlinc`, the resulting program doesn't
have the same name as the source program. Instead, the compiler appends a `Kt`
to the name. To see it, run `ls` or `dir` on the `helloworld` subdirectory.
You'll see that the directory contains `HelloWorldKt.class`. What's important
is the part before the `.class`. This is the actual name of the program:
`HelloWorldKt`.
Now we can run the program:
```
kotlin HelloWorldKt
```
And you'll see the output on the console:
```
Hello, world!
```
## Packages
If the program is in a package, the package name is also required to run the
program. That is, if `Foo.kt` contains a `package` statement:
```
package bar
```
then you cannot simply say:
```
kotlin Foo
```
You'll get a message starting with `error: could not find or load`...
If you were to compile this program, you'd see there's a new subdirectory
called `bar`. The name of the subdirectory that appears when you run `kotlinc`
corresponds to the `package` name in the program that was compiled.
If the program is packaged under `bar`, we give the package name followed by a
"dot," then the program's name:
```
kotlin bar.FooKt
```
# Appendix C: The Kotlin REPL
The Kotlin interpreter is also called the REPL (for *Read-Evaluate-Print-
Loop*). To use this you must first install the
latest version (1.5 or higher) of the [Kotlin command-line
compiler](http://kotlinlang.org/docs/tutorials/command-line.html).
> NOTE: You do not need to install command-line Kotlin for the operations
> described previously in this README.
## Install Kotlin
In this book, we use Kotlin version 1.5, the latest available at the time. The
detailed installation instructions for the command-line compiler are available
at [The Kotlin Site](https://kotlinlang.org/docs/tutorials/command-line.html).
To check your installation, open a new shell and type:
```
kotlin -version
```
at the shell prompt. You'll see the version information for your Kotlin
installation.
## The REPL
To start the REPL, type `kotlinc` by itself on the command line. You should see
something like the following:
```
Welcome to Kotlin version 1.5 (JRE 1.8.0_144-b01)
Type :help for help, :quit for quit
>>>
```
The exact version numbers will vary depending on the versions of Kotlin
and Java you've installed, but make sure that you're running Kotlin 1.5
or greater.
The REPL gives you immediate interactive feedback, which is helpful for
experimentation. For example, you can do arithmetic:
```
>>> 42 * 11.3
474.6
```
Find out more by typing `:help` at the Kotlin prompt. To exit the REPL, type:
```
>>> :quit
```
To compile and run examples using the Kotlin command-line tools, see
[Command-Line Hello World](#appendix-b-command-line-hello-world).
# Appendix D: Testing
The test system is built in so that we (the authors) can verify the correctness
of what goes into the book.
You don't need to run the tests, but if you want to, you can just run `gradlew
test` (on Windows) or `./gradlew test` (Mac/Linux).
There are two steps in creating and running the tests, which you can run
separately if you want (again, just running the Gradle `test` command will
validate the code, so you don't need to do the following steps):
1. `gradlew GenerateTests` generates tests from the sources in this repository.
It creates (or recreates) the file `TestExamples.java`. You normally don't need to run this; the
`TestExamples.java` in the repository should be up to date.
2. `gradlew TestExamples` runs the tests in `TestExamples.java`.
Alternatively, `TestExamples.java` can be called as a regular **JUnit** test class.
| 0 |
meddle0x53/learning-rxjava | Examples of using RxJava | null | # Learning Reactive Programming With Java 8 Example Runner
This project contains the examples of the 'Learning Reactive Programming With Java 8' book.
## Installing and running this program.
* Of course you'll need Git :).
* To run these examples you need Java 8, if you don't have it, navigate to Oracle's site and download/install it.
* Now you can clone this project by running :
```
git clone https://github.com/meddle0x53/learning-rxjava.git
```
* Navigate to the root of the project (`cd learning-rxjava`) and run :
```
./gradlew build
```
* This will download and install all the dependencies needed by the project and will compile it.
* You can open the project with Eclipse and run the examples. You'll need the Gradle plugin for Eclipse.
### Running example from console
```bashgra
./gradlew execute -Pchapter=1 -Pexample=ReactiveSumV1
```
## Examples
Here are the descriptions of all the examples in the book.
#### 01. Iterator VS Observable
This example is used in the book in the 'Comparing the Iterator pattern and the RxJava Observable' of the first chapter.
It demonstrates the difference between RxJava's Observables and the Iterators, by iterating over a list of strings.
The `Observable.from` method is introduced here for the first time, as well as subscribing.
The example can be found here [ObservableVSIterator](https://github.com/meddle0x53/learning-rxjava/blob/master/src/main/java/com/packtpub/reactive/chapter01/ObservableVSIterator.java)
#### 02. Reactive Sum, version 1
This is example demonstrates a reactive sum, which is updated on change of any of its collectors. It is demonstrates
many of the features of RxJava, like Observers, Schedulers Observable transformations, filtering and combining.
The example can be found here [ReactiveSumV1](https://github.com/meddle0x53/learning-rxjava/blob/master/src/main/java/com/packtpub/reactive/chapter01/ReactiveSumV1.java)
#### 03. Introduction to the new syntax and semantics
Demonstrates creating and using lambdas, passing them to methods, that receive Functional Interfaces as parameters and references
to existing methods.
The example can be found here [Java8LambdasSyntaxIntroduction](https://github.com/meddle0x53/learning-rxjava/blob/master/src/main/java/com/packtpub/reactive/chapter02/Java8LambdasSyntaxIntroduction.java)
#### 04. Reactive Sum, version 2 (with lambdas)
Another implementation of the 'Reactive Sum', similar to the on of the first chapter, but it uses the new Java 8 syntax with lambdas.
The example can be found here [ReactiveSumV2](https://github.com/meddle0x53/learning-rxjava/blob/master/src/main/java/com/packtpub/reactive/chapter02/ReactiveSumV2.java)
#### 05. Pure and higher functions
Demonstrates pure and higher order functions. Applies higher order functions to other functions.
The example can be found here [PureAndHigherOrderFunctions](https://github.com/meddle0x53/learning-rxjava/blob/master/src/main/java/com/packtpub/reactive/chapter02/PureAndHigherOrderFunctions.java)
#### 06. Introduction to monads
Shows implementation and uses of a monad. The Optional monad.
The example can be found here [Monads](https://github.com/meddle0x53/learning-rxjava/blob/master/src/main/java/com/packtpub/reactive/chapter02/Monads.java)
#### 07. Observables and monads
Shows that Observables are not true monads. They are monad-like structures though and benefit from that.
The example can be found here [ObservablesAndMonads](https://github.com/meddle0x53/learning-rxjava/blob/master/src/main/java/com/packtpub/reactive/chapter02/ObservablesAndMonads.java)
#### 08. Creating Observables with Observable.from
A set of examples of using the Observable.from method for creating Observables from collections, arrays and Iterables.
The example can be found here [CreatingObservablesWithFrom](https://github.com/meddle0x53/learning-rxjava/blob/master/src/main/java/com/packtpub/reactive/chapter03/CreatingObservablesWithFrom.java)
#### 09. Using Observable.from with Future
Demonstrates creating Observables using the Observable.from(Future) method.
The example can be found here [CreatingObservablesWithFromFuture](https://github.com/meddle0x53/learning-rxjava/blob/master/src/main/java/com/packtpub/reactive/chapter03/CreatingObservablesWithFromFuture.java)
#### 10. Using the Observable.just method to create Observables
Demonstrates creating Observables using the Observable.just method.
The example can be found here [CreatingObservablesUsingJust](https://github.com/meddle0x53/learning-rxjava/blob/master/src/main/java/com/packtpub/reactive/chapter03/CreatingObservablesUsingJust.java)
#### 11. A few factory methods for creating Observables (Chapter 3, pages 43-46)
Demonstrates using Observable.interval, Observable.timer, Observable.error,
Observable.never, Observable.empty and Observable.range for Obsevable creation.
The example can be found here [CreatingObservablesUsingVariousFactoryMethods](https://github.com/meddle0x53/learning-rxjava/blob/master/src/main/java/com/packtpub/reactive/chapter03/CreatingObservablesUsingVariousFactoryMethods.java)
#### 12. Demonstration of the Observable.create method (Chapter 3, pages 46-50)
Demonstrates using Observable.create for creating custom Observables.
Contains unsubscribing and implementing unsubscribing logic in Observable.create.
The example can be found here [ObservableCreateExample](https://github.com/meddle0x53/learning-rxjava/blob/master/src/main/java/com/packtpub/reactive/chapter03/ObservableCreateExample.java)
#### 13. A ConnectableObservable demonstration (Chapter 3, pages 51-53)
Demonstration of ConnectableObservables and the methods realted to them - publish, refCount, share.
The example can be found here [UsingConnectableObservables](https://github.com/meddle0x53/learning-rxjava/blob/master/src/main/java/com/packtpub/reactive/chapter03/UsingConnectableObservables.java)
#### 14. Subjects demonstration (Chapter 3, pages 53-54)
Demonstrates using a Subject to subscribe to an Observables, propagating its notifications to multiple Subscribers.
The example can be found here [SubjectsDemonstration](https://github.com/meddle0x53/learning-rxjava/blob/master/src/main/java/com/packtpub/reactive/chapter03/SubjectsDemonstration.java)
#### 15. Reactive Sum, version 3 (with Subjects) (Chapter 3, pages 55-57)
The 'Reactive Sum' is implemented through reactive properties, which are in fact BehaviorSubjects.
The example can be found here [ReactiveSumV3](https://github.com/meddle0x53/learning-rxjava/blob/master/src/main/java/com/packtpub/reactive/chapter03/ReactiveSumV3.java)
#### 16. Examples of using Observable transformations (Chapter 4, pages 59-66)
Demonstration of using map, flatMap, flatMapIterable and switchMap.
The example can be found here [MappingExamples](https://github.com/meddle0x53/learning-rxjava/blob/master/src/main/java/com/packtpub/reactive/chapter04/MappingExamples.java)
#### 17. Working with files using flatMap (Chapter 4, pages 60-62)
Demonstration of using flatMap with an Observable created by directory stream,
reading all the files from it, using Observables.
The example can be found here [FlatMapAndFiles](https://github.com/meddle0x53/learning-rxjava/blob/master/src/main/java/com/packtpub/reactive/chapter04/FlatMapAndFiles.java)
#### 18. Demonstration of using the Observable#groupBy operator (Chapter 4, pages 67-69)
Demonstrates how the groupBy operator can be used.
The example can be found here [UsingGroupBy](https://github.com/meddle0x53/learning-rxjava/blob/master/src/main/java/com/packtpub/reactive/chapter04/UsingGroupBy.java)
#### 19. Demonstration of various transforming operators (Chapter 4, pages 69-71)
Demonstration of working with the cast, materialize, timestamp and timeInterval operators.
The example can be found here [VariousTransformationsDemonstration](https://github.com/meddle0x53/learning-rxjava/blob/master/src/main/java/com/packtpub/reactive/chapter04/VariousTransformationsDemonstration.java)
#### 20. Various examples of using filtering operators (Chapter 4, pages 71-75)
Demonstrates the filter, takeLast, last, takeLastBuffer, lastOrDefault,
skipLast, skip, first, elementAt, distinct, distinctUntilChanged and ofType operators.
The example can be found here [FilteringExamples](https://github.com/meddle0x53/learning-rxjava/blob/master/src/main/java/com/packtpub/reactive/chapter04/FilteringExamples.java)
#### 21. Demonstration of using Observable#scan and more (Chapter 4, pages 76-78)
Demonstrates the scan operator and contains an example of working with data using the majority of the operators learned through the chapter.
The example can be found here [ScanAndUsingMultipleOperators](https://github.com/meddle0x53/learning-rxjava/blob/master/src/main/java/com/packtpub/reactive/chapter04/ScanAndUsingMultipleOperators.java)
#### 22. Examples of combining Observables (Chapter 5, pages 82-88)
Demonstrates combining Observables using Observable.zip, Observable.merge and Observable.concat.
The example can be found here [CombiningObservables](https://github.com/meddle0x53/learning-rxjava/blob/master/src/main/java/com/packtpub/reactive/chapter05/CombiningObservables.java)
#### 23. Some examples of using conditionals (Chapter 5, pages 88-91)
Demonstration of using the Observable.amb, Observable.takeWhile, Observable.takeUntil,
Observable.skipUntil and Observable.defaultIfEmpty.
The example can be found here [Conditionals](https://github.com/meddle0x53/learning-rxjava/blob/master/src/main/java/com/packtpub/reactive/chapter05/Conditionals.java)
#### 24. Examples of handling errors (Chapter 5, pages 92-95)
A demonstrates working with Observable.onErrorReturn, Observable.onErrorResumeNext and Observable.onExceptionResumeNext
as well as retrying with Observable.retry and Observable.retryWhen.
The example can be found here [HandlingErrors](https://github.com/meddle0x53/learning-rxjava/blob/master/src/main/java/com/packtpub/reactive/chapter05/HandlingErrors.java)
#### 25. Example of doing HTTP requests and handling responses with Observables (Chapter 5, pages 95-99)
Using multiple Observable operators in order to handle and augment an HTTP response from Github.
The example can be found here [HttpRequestsExample](https://github.com/meddle0x53/learning-rxjava/blob/master/src/main/java/com/packtpub/reactive/chapter05/HttpRequestsExample.java)
#### 26. Observable.interval and Schedulers (Chapter 6, pages 103-105)
More information of Observable.interval and its default Scheduler. Contains an example of debugging information of the emitted items and the current Thread.
The example can be found here [IntervalAndSchedulers](https://github.com/meddle0x53/learning-rxjava/blob/master/src/main/java/com/packtpub/reactive/chapter06/IntervalAndSchedulers.java)
#### 27. Demonstration of the different Schedulers types (Chapter 6, pages 106-114)
A collection of examples of using the different Schedulers.
The example can be found here [SchedulersTypes](https://github.com/meddle0x53/learning-rxjava/blob/master/src/main/java/com/packtpub/reactive/chapter06/SchedulersTypes.java)
#### 28. A few examples of observeOn and subscribeOn (Chapter 6, pages 115-119)
Demonstrates using subscribeOn and observeOn with Schedulers and Observables.
The example can be found here [SubscribeOnAndObserveOn](https://github.com/meddle0x53/learning-rxjava/blob/master/src/main/java/com/packtpub/reactive/chapter06/SubscribeOnAndObserveOn.java)
#### 29. Demonstraton of parallelism (Chapter 6, pages 121-122)
Demonstrates parallelism by executing a number of requests in parallel.
The example can be found here [ParallelRequestsExample](https://github.com/meddle0x53/learning-rxjava/blob/master/src/main/java/com/packtpub/reactive/chapter06/ParallelRequestsExample.java)
#### 30. Examples demonstrating backpressure and buffering operators (Chapter 6, pages 122-127)
Demonstrates using the Observable#sample, Observable#buffer, Observable#window
Observable#throttleLast, Observable#debounce, Observable#onBackpressureDrop and
Observable#onBackpressureBuffer operators
The example can be found here [BackpressureExamples](https://github.com/meddle0x53/learning-rxjava/blob/master/src/main/java/com/packtpub/reactive/chapter06/BackpressureExamples.java)
#### 31. A demonstration of using Blocking Observables (Chapter 7, pages 133-136)
Examples of using BlockingObservable and their operators -
BlockingObservable#forEach, BlockingObservable#first, BlockingObservable#next,
BlockingObservable#last and BlockingObservable#single.
Includes examples of Observable#count and Observable#toList combined with the Observable#toBlocking operator.
The example can be found here [BlockingObservablesAndOperators](https://github.com/meddle0x53/learning-rxjava/blob/master/src/main/java/com/packtpub/reactive/chapter07/BlockingObservablesAndOperators.java)
#### 32. Unit test demonstrating different ways of testing Observables (Chapter 7, pages 131-133, 136-138)
Includes simple subscription test, test with BlockingObservable and test with TestSubscriber.
The example can be found here [SortedObservableTest](https://github.com/meddle0x53/learning-rxjava/blob/master/src/test/java/com/packtpub/reactive/chapter07/SortedObservableTest.java)
#### 33. Example of testing asynchronous Observables (Chapter 7, pages 139-140)
A unit test testing the custom reateObservable#interval method.
The example can be found here [CreateObservableIntervalTest](https://github.com/meddle0x53/learning-rxjava/blob/master/src/test/java/com/packtpub/reactive/chapter07/CreateObservableIntervalTest.java)
#### 34. Resource management demonstration (Chapter 8, pages 142-148)
Demonstration of custom resource management with Observable#using.
The example can be found here [ResourceManagement](https://github.com/meddle0x53/learning-rxjava/blob/master/src/main/java/com/packtpub/reactive/chapter08/ResourceManagement.java)
#### 35. Example of using Observable#lift for executing custom operators (Chapter 8, pages 148-152)
Demonstrates implementing values with indices using lift and the custom operator Indexed.
The example can be found here [Lift](https://github.com/meddle0x53/learning-rxjava/blob/master/src/main/java/com/packtpub/reactive/chapter08/Lift.java)
#### 36. Unit test for the Indexed operator (Chapter 8, pages 152-153)
The example can be found here [IndexedTest](https://github.com/meddle0x53/learning-rxjava/blob/master/src/test/java/com/packtpub/reactive/chapter08/IndexedTest.java)
#### 37. Demonstration of the Observable.compose operator (Chapter 8, pages 153)
Example of implementing a Transformer and passing it to Observable#compose.
The example can be found here [Compose](https://github.com/meddle0x53/learning-rxjava/blob/master/src/main/java/com/packtpub/reactive/chapter08/Compose.java)
#### 38. Unit test for the OddFilter Transformer. (Chapter 8, pages 154)
The example can be found here [OddFilterTest](https://github.com/meddle0x53/learning-rxjava/blob/master/src/test/java/com/packtpub/reactive/chapter08/OddFilterTest.java)
| 0 |
bitstorm/Wicket-tutorial-examples | Code examples for the offcial Wicket user guide | apache-wicket java web web-framework wicket wicket-tutorial | Wicket-tutorial-examples
========================
This repository contains the example projects used in the [Wicket user guide](http://wicket.apache.org/learn/#guide).
## Building the project
The project is a multi-module Maven project. To compile it run 'mvn compile' from the root directory. To run the examples locally follows these steps:
* run 'mvn install' from the root directory
* go into project StarterExamples and run 'mvn jetty:run' or 'mvn tomcat:run'
To run a single example project you have to install first project BootstrapCommon ('mvn install'). Then go into the folder of the project you want to run, type 'mvn jetty:run' or 'mvn tomcat:run' and then point your browser to http://localhost:8080
## See the examples on line
The examples can be explored on line at [http://wicket-tutorial-examples.it:8080/](http://wicket-tutorial-examples.it:8080/) (courtesy of [Host.it](https://host.it/)).
NOTE: examples are hosted on a free account, so you might need to wait few seconds before server responds.
## Contributing to this guide
If you want to contribute to the guide with corrections or new contents, you can find how to do it [here](http://wicket.apache.org/contribute/userguide.html).
## The author
My name is Andrea Del Bene and I'm a passionate enterprise web developer and an advocate of Apache Wicket. I started programming in Java since version 1.2 and I'm a strong supporter of open source technologies.
If you like this project and want to support me, you can offer me a beer :-) :
<p> <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=RGHPTV2QDK8VN" rel="nofollow"><img src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif"></a> </p>
| 0 |
rathboma/hive-extension-examples | Examples for extending hive | null | # Hive UDF Examples
This code accompanies [this article which walks through creating UDFs in Apache Hive][blog-post].
## Compile
```
mvn compile
```
## Test
```
mvn test
```
## Build
```
mvn assembly:single
```
## Run
```
%> hive
hive> ADD JAR /path/to/assembled.jar;
hive> create temporary function hello as 'com.matthewrathbone.example.SimpleUDFExample';
hive> select hello(firstname) from people limit 10;
```
[blog-post]:http://blog.matthewrathbone.com/2013/08/10/guide-to-writing-hive-udfs.html | 0 |
Nirman-Rathod/Spring | Spring Tutorials and Examples | null | null | 0 |
powermock/powermock-examples-maven | Examples of specific uses of PowerMock. | null | # PowerMock Examples.
[](https://travis-ci.org/powermock/powermock-examples-maven)
This project contains different examples of specific uses of PowerMock.
| 0 |
microservices-patterns/ftgo-application | Example code for the book Microservice patterns | null | null | 1 |
CodelyTV/java-ddd-example | ♨️ DDD in Java skeleton & examples. Course: | codely codelytv cqrs cucumber cucumber-java ddd ddd-architecture ddd-cqrs ddd-example gradle hexagon java java-skeleton junit rabbitmq | # ☕🚀 Java DDD example: Save the boilerplate in your new projects
<img src="http://codely.tv/wp-content/uploads/2016/05/cropped-logo-codelyTV.png" align="left" width="192px" height="192px"/>
<img align="left" width="0" height="192px" hspace="10"/>
> ⚡ Start your Java projects as fast as possible
[](https://codely.tv)
[](https://github.com/CodelyTV/java-ddd-example/actions)
## ℹ️ Introduction
This is a repository intended to serve as a starting point if you want to bootstrap a Java project with JUnit and Gradle.
Here you have the [course on CodelyTV Pro where we explain step by step all this](https://pro.codely.tv/library/ddd-en-java/about/?utm_source=github&utm_medium=social&utm_campaign=readme) (Spanish)
## 🏁 How To Start
1. Install Java 11: `brew cask install corretto`
2. Set it as your default JVM: `export JAVA_HOME='/Library/Java/JavaVirtualMachines/amazon-corretto-11.jdk/Contents/Home'`
3. Clone this repository: `git clone https://github.com/CodelyTV/java-ddd-example`.
4. Bring up the Docker environment: `make up`.
5. Execute some [Gradle lifecycle tasks](https://docs.gradle.org/current/userguide/java_plugin.html#lifecycle_tasks) in order to check everything is OK:
1. Create [the project JAR](https://docs.gradle.org/current/userguide/java_plugin.html#sec:jar): `make build`
2. Run the tests and plugins verification tasks: `make test`
6. Start developing!
## ☝️ How to update dependencies
* Gradle ([releases](https://gradle.org/releases/)): `./gradlew wrapper --gradle-version=WANTED_VERSION --distribution-type=bin`
## 💡 Related repositories
### ☕ Java
* 📂 [Java Basic example](https://github.com/CodelyTV/java-basic-example)
* ⚛ [Java OOP Examples](https://github.com/CodelyTV/java-oop-examples)
* 🧱 [Java SOLID Examples](https://github.com/CodelyTV/java-solid-examples)
* 🥦 [Java DDD Example](https://github.com/CodelyTV/java-ddd-example)
### 🐘 PHP
* 📂 [PHP Basic example](https://github.com/CodelyTV/php-basic-example)
* 🎩 [PHP DDD example](https://github.com/CodelyTV/php-ddd-example)
* 🥦 [PHP DDD Example](https://github.com/CodelyTV/php-ddd-example)
### 🧬 Scala
* 📂 [Scala Basic example](https://github.com/CodelyTV/scala-basic-example)
* ⚡ [Scala Basic example (g8 template)](https://github.com/CodelyTV/scala-basic-example.g8)
* ⚛ [Scala Examples](https://github.com/CodelyTV/scala-examples)
* 🥦 [Scala DDD Example](https://github.com/CodelyTV/scala-ddd-example)
| 0 |
eventuate-examples/eventuate-examples-restaurant-management | Event-driven microservices version of restaurant management from POJOs in Action | null |
# Restaurant management application
Food to Go is a fictitious, on-demand logistics company that delivers takeout orders from restaurants to customers.
A key part of the application is the restaurant management service, which maintains a database of restaurants that can be queried for availability to deliver an order to a customer at a particular time.
This version of the restaurant management service has an architecture based on microservices, event sourcing and Command Query Responsibility Segregation (CQRS).
It is written in Java and uses the Eventuate Platform, Spring Boot, and Redis.
Don't forget to take a look at the other [Eventuate example applications](http://eventuate.io/exampleapps.html).
# Got questions?
Don't hesitate to create an issue or see
* [Website](http://eventuate.io)
* [Mailing list](https://groups.google.com/d/forum/eventuate-users)
* [Slack](https://eventuate-users.slack.com). [Get invite](https://eventuateusersslack.herokuapp.com/)
* [Contact us](http://eventuate.io/contact.html).
# Architecture
The following diagram shows the architecture of the application.
<img class="img-responsive" src="http://eventuate.io/demos/eventuate-restaurant-management-architecture.png">
The application is built using CQRS.
The command side service handles creates, updates and deletes.
It defines the following REST endpoints:
* POST /restaurant - create a restaurant
* PUT /restaurant/*id* - update a restaurant
* DELETE /restaurant/*id* - delete a restaurant
The command side service stores restaurants in the Eventuate event store.
The query side service handles GET requests.
It subscribes to Restaurant events and maintains a denormalized representation of the restaurants in Redis for fast querying.
The query side service defines the following REST endpoints:
* GET /restaurant/*id* - finds a restaurant
* GET /availablerestaurants?zipcode=xx&dayOfWeek=xx&hour=xx&minute=xx - finds restaurants that are available to deliver to the specified zip code at the specified time
# About Eventuate™

The application is built using [Eventuate](http://eventuate.io/), which is an application platform for writing transactional microservices.
It provides a simple yet powerful event-driven programming model that is based on event sourcing and Command Query Responsibility Segregation (CQRS).
Eventuate solves the distributed data management problems inherent in a microservice architecture.
It consists of a scalable, distributed event store and client libraries for various languages and frameworks including Java, Scala, and the Spring framework.
There are two versions of Eventuate:
* [Eventuate SaaS server](http://eventuate.io/usingeventuate.html) - this is a full featured event store that is hosted on AWS
* [Eventuate Local](http://eventuate.io/usingeventuate.html) - an open-source event store that is built using MySQL and Kafka
# Building and running the application.
This is a Java 8, Gradle project. However, you do not need to install Gradle since it will be downloaded automatically. You just need to have Java 8 installed.
The details of how to build and run the services depend slightly on whether you are using Eventuate SaaS or Eventuate Local.
## Building and running using Eventuate SaaS
First, must [sign up to get your credentials](https://signup.eventuate.io/) in order to get free access to the SaaS version.
Next, build the application:
```
./gradlew assemble
```
Next, you can launch the application using [Docker Compose](https://docs.docker.com/compose/)
```
docker-compose up -d
```
## Building and running using Eventuate Local
First, build the application:
```
./gradlew assemble -P eventuateDriver=local
```
Next, you can launch the application using [Docker Compose](https://docs.docker.com/compose/)
```
export DOCKER_HOST_IP=...
docker-compose -f docker-compose-eventuate-local.yml up -d
```
Note: You need to set `DOCKER_HOST_IP` before running Docker Compose.
`DOCKER_HOST_IP` is the IP address of the machine running the Docker daemon.
It must be an IP address or resolvable hostname.
It cannot be `localhost`.
See this [guide to setting `DOCKER_HOST_IP`](http://eventuate.io/docs/usingdocker.html) for more information.
## Using the application
Finally, you can use the Swagger UI provided by the services to create, update, delete and view restaurants:
* `http://${DOCKER_HOST_IP?}:8081/swagger-ui.html` - Restaurant command-side service
* `http://${DOCKER_HOST_IP?}:8082/swagger-ui.html` - Restaurant query-side service
Note: DOCKER_HOST_IP is the IP address of the machine running the Docker daemon.
(Hint: best to open these URLs in separate tabs)
# Got questions?
Don't hesitate to create an issue or see
* [Website](http://eventuate.io)
* [Mailing list](https://groups.google.com/d/forum/eventuate-users)
* [Slack](https://eventuate-users.slack.com). [Get invite](https://eventuateusersslack.herokuapp.com/)
* [Contact us](http://eventuate.io/contact.html).
| 0 |
OWASP/wrongsecrets | Vulnerable app with examples showing how to not use secrets | aws azure ctf devsecops docker gcp hashicorp-vault java keepass kubernetes owasp secrets secrets-management security terraform-aws terraform-azure terraform-gcp vault vulnerable-web-app | <!-- CRE Link: [223-780](https://www.opencre.org/cre/223-780?register=true&type=tool&tool_type=training&tags=secrets,training&description=With%20this%20app%2C%20we%20have%20packed%20various%20ways%20of%20how%20to%20not%20store%20your%20secrets.%20These%20can%20help%20you%20to%20realize%20whether%20your%20secret%20management%20is%20ok.%20The%20challenge%20is%20to%20find%20all%20the%20different%20secrets%20by%20means%20of%20various%20tools%20and%20techniques.%20Can%20you%20solve%20all%20the%2015%20challenges%3F) -->
# OWASP WrongSecrets
[](https://twitter.com/intent/tweet?text=Want%20to%20dive%20into%20secrets%20management%20and%20do%20some%20hunting?%20try%20this&url=https://github.com/OWASP/wrongsecrets&hashtags=secretsmanagement,secrets,hunting,p0wnableapp,OWASP,WrongSecrets) [<img src="https://img.shields.io/badge/-MASTODON-%232B90D9?style=for-the-badge&logo=mastodon&logoColor=white" width=84>](https://tootpick.org/#text=Want%20to%20dive%20into%20secrets%20management%20and%20do%20some%20hunting?%20try%20this%0A%0Ahttps://github.com/OWASP/wrongsecrets%20%23secretsmanagement,%20%23secrets,%20%23hunting,%20%23p0wnableapp,%20%23OWASP,%20%23WrongSecrets) [<img src="https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white" width=80>](https://www.linkedin.com/shareArticle/?url=https://www.github.com/OWASP/wrongsecrets&title=OWASP%20WrongSecrets)
[](https://github.com/OWASP/wrongsecrets/actions/workflows/main.yml) [](https://github.com/OWASP/wrongsecrets/actions/workflows/pre-commit.yml) [](https://github.com/OWASP/wrongsecrets/actions/workflows/terraform.yml) [](https://github.com/OWASP/wrongsecrets/actions/workflows/codeql-analysis.yml) [](https://github.com/OWASP/wrongsecrets/actions/workflows/link_checker.yml)[](https://github.com/OWASP/wrongsecrets/actions/workflows/java_swagger_doc.yml) [](https://github.com/OWASP/wrongsecrets/actions/workflows/heroku_tests.yml)
[](https://github.com/OWASP/wrongsecrets/actions/workflows/minikube-k8s-test.yml) [](https://github.com/OWASP/wrongsecrets/actions/workflows/minikube-vault-test.yml) [](https://github.com/OWASP/wrongsecrets/actions/workflows/container_test.yml)[](https://github.com/OWASP/wrongsecrets/actions/workflows/container-alts-test.yml)
[](https://github.com/OWASP/wrongsecrets/actions/workflows/dast-zap-test.yml)
[](https://owasp.org/projects/)
[](https://bestpractices.coreinfrastructure.org/projects/7024)
[](https://github.com/OWASP/wrongsecrets/discussions)
Welcome to the OWASP WrongSecrets game! The game is packed with real life examples of how to _not_ store secrets in your software. Each of these examples is captured in a challenge, which you need to solve using various tools and techniques. Solving these challenges will help you recognize common mistakes & can help you to reflect on your own secrets management strategy.
Can you solve all the 46 challenges?
Try some of them on [our Heroku demo environment](https://wrongsecrets.herokuapp.com/).
Want to play the other challenges? Read the instructions on how to set them up below.

<a href="https://github.com/vshymanskyy/StandWithUkraine/blob/main/README.md"><img src="https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-no-action.svg" /></a>
## Table of contents
- [Support](#support)
- [Basic docker exercises](#basic-docker-exercises)
- [Running these on Heroku](#running-these-on-heroku)
- [Running these on Render.io](#running-these-on-renderio)
- [Running these on Railway](#running-these-on-railway)
- [Basic K8s exercise](#basic-k8s-exercise)
- [Minikube based](#minikube-based)
- [k8s based](#k8s-based)
- [Vault exercises with minikube](#vault-exercises-with-minikube)
- [Cloud Challenges](#cloud-challenges)
- [Running WrongSecrets in AWS](#running-wrongsecrets-in-aws)
- [Running WrongSecrets in GCP](#running-wrongsecrets-in-gcp)
- [Running WrongSecrets in Azure](#running-wrongsecrets-in-azure)
- [Running Challenge15 in your own cloud only](#running-challenge15-in-your-own-cloud-only)
- [Do you want to play without guidance?](#do-you-want-to-play-without-guidance-or-spoils)
- [Special thanks & Contributors](#special-thanks--contributors)
- [Sponsorships](#sponsorships)
- [Help Wanted](#help-wanted)
- [Use OWASP WrongSecrets as a secret detection benchmark](#use-owasp-wrongsecrets-as-a-secret-detection-benchmark)
- [CTF](#ctf)
- [CTFD Support](#ctfd-support)
- [FBCTF Support](#fbctf-support-experimental)
- [Notes on development](#notes-on-development)
- [Dependency management](#dependency-management)
- [Get the project started in IntelliJ IDEA](#get-the-project-started-in-intellij-idea)
- [Automatic reload during development](#automatic-reload-during-development)
- [How to add a Challenge](#how-to-add-a-challenge)
- [Local testing](#local-testing)
- [Local Automated testing](#Local-automated-testing)
- [Want to play, but are not allowed to install the tools?](#want-to-play-but-are-not-allowed-to-install-the-tools)
- [Want to disable challenges in your own release?](#want-to-disable-challenges-in-your-own-release)
- [Further reading on secrets management](#further-reading-on-secrets-management)
## Support
Need support? Contact us
via [OWASP Slack](https://owasp.slack.com/archives/C02KQ7D9XHR) for which you sign up [here](https://owasp.org/slack/invite)
, file a [PR](https://github.com/OWASP/wrongsecrets/pulls), file
an [issue](https://github.com/OWASP/wrongsecrets/issues) , or
use [discussions](https://github.com/OWASP/wrongsecrets/discussions). Please note that this is an OWASP volunteer
based project, so it might take a little while before we respond.
Copyright (c) 2020-2024 Jeroen Willemsen and WrongSecrets contributors.
## Basic docker exercises
_Can be used for challenges 1-4, 8, 12-32, 34, 35-43_
For the basic docker exercises you currently require:
- Docker [Install from here](https://docs.docker.com/get-docker/)
- Some Browser that can render HTML
You can install it by doing:
```bash
docker run -p 8080:8080 jeroenwillemsen/wrongsecrets:latest-no-vault
```
Now you can try to find the secrets by means of solving the challenge offered at:
- [localhost:8080/challenge/challenge-1](http://localhost:8080/challenge/challenge-1)
- [localhost:8080/challenge/challenge-2](http://localhost:8080/challenge/challenge-2)
- [localhost:8080/challenge/challenge-3](http://localhost:8080/challenge/challenge-3)
- [localhost:8080/challenge/challenge-4](http://localhost:8080/challenge/challenge-4)
- [localhost:8080/challenge/challenge-8](http://localhost:8080/challenge/challenge-8)
- [localhost:8080/challenge/challenge-12](http://localhost:8080/challenge/challenge-12)
- [localhost:8080/challenge/challenge-13](http://localhost:8080/challenge/challenge-13)
- [localhost:8080/challenge/challenge-14](http://localhost:8080/challenge/challenge-14)
- [localhost:8080/challenge/challenge-15](http://localhost:8080/challenge/challenge-15)
- [localhost:8080/challenge/challenge-16](http://localhost:8080/challenge/challenge-16)
- [localhost:8080/challenge/challenge-17](http://localhost:8080/challenge/challenge-17)
- [localhost:8080/challenge/challenge-18](http://localhost:8080/challenge/challenge-18)
- [localhost:8080/challenge/challenge-19](http://localhost:8080/challenge/challenge-19)
- [localhost:8080/challenge/challenge-20](http://localhost:8080/challenge/challenge-20)
- [localhost:8080/challenge/challenge-21](http://localhost:8080/challenge/challenge-21)
- [localhost:8080/challenge/challenge-22](http://localhost:8080/challenge/challenge-22)
- [localhost:8080/challenge/challenge-23](http://localhost:8080/challenge/challenge-23)
- [localhost:8080/challenge/challenge-24](http://localhost:8080/challenge/challenge-24)
- [localhost:8080/challenge/challenge-25](http://localhost:8080/challenge/challenge-25)
- [localhost:8080/challenge/challenge-26](http://localhost:8080/challenge/challenge-26)
- [localhost:8080/challenge/challenge-27](http://localhost:8080/challenge/challenge-27)
- [localhost:8080/challenge/challenge-28](http://localhost:8080/challenge/challenge-28)
- [localhost:8080/challenge/challenge-29](http://localhost:8080/challenge/challenge-29)
- [localhost:8080/challenge/challenge-30](http://localhost:8080/challenge/challenge-30)
- [localhost:8080/challenge/challenge-31](http://localhost:8080/challenge/challenge-31)
- [localhost:8080/challenge/challenge-32](http://localhost:8080/challenge/challenge-32)
- [localhost:8080/challenge/challenge-34](http://localhost:8080/challenge/challenge-34)
- [localhost:8080/challenge/challenge-35](http://localhost:8080/challenge/challenge-35)
- [localhost:8080/challenge/challenge-36](http://localhost:8080/challenge/challenge-36)
- [localhost:8080/challenge/challenge-37](http://localhost:8080/challenge/challenge-37)
- [localhost:8080/challenge/challenge-38](http://localhost:8080/challenge/challenge-38)
- [localhost:8080/challenge/challenge-39](http://localhost:8080/challenge/challenge-39)
- [localhost:8080/challenge/challenge-40](http://localhost:8080/challenge/challenge-40)
- [localhost:8080/challenge/challenge-41](http://localhost:8080/challenge/challenge-41)
- [localhost:8080/challenge/challenge-42](http://localhost:8080/challenge/challenge-42)
- [localhost:8080/challenge/challenge-43](http://localhost:8080/challenge/challenge-43)
Note that these challenges are still very basic, and so are their explanations. Feel free to file a PR to make them look
better ;-).
### Running these on Heroku
You can test them out at [https://wrongsecrets.herokuapp.com/](https://wrongsecrets.herokuapp.com/) as well! The folks at Heroku have given us an awesome open source support package, which allows us to run the app for free there, where it is almost always up. Still, please do not fuzz and/or try to bring it down: you would be spoiling it for others that want to testdrive it.
Use [this link](https://wrongsecrets.herokuapp.com/) to use our hosted version of the app. If you want to host it on Heroku yourself (e.g., for running a training), you can do so by clicking [this link](https://heroku.com/deploy?template=https://github.com/OWASP/wrongsecrets/tree/master). Please be aware that this will incur costs for which this project and/or its maintainers cannot be held responsible.
### Running these on Render.io
*status: experimental*
You can test them out at [https://wrongsecrets.onrender.com/](https://wrongsecrets.onrender.com/). Please understand that we run on a free-tier instance, we cannot give any guarantees. Please do not fuzz and/or try to bring it down: you would be spoiling it for others that want to testdrive it.
Want to deploy yourself with Render? Click the button below:
[](https://render.com/deploy?repo=https://github.com/OWASP/wrongsecrets)
### Running these on Railway
*status: maintained by [alphasec.io](https://github.com/alphasecio)*
If you want to host WrongSecrets on Railway, you can do so by deploying [this one-click template](https://railway.app/new/template/7pnwRj). Railway does not offer an always-free plan anymore, but the free trial is good enough to test-drive this before you decide to upgrade. If you need a step-by-step companion guide, see [this blog post](https://alphasec.io/test-your-secret-management-skills-with-owasp-wrongsecrets/).
[](https://railway.app/new/template/7pnwRj)
## Basic K8s exercise
_Can be used for challenges 1-6, 8, 12-43_
### Minikube based
Make sure you have the following installed:
- Docker [Install from here](https://docs.docker.com/get-docker/)
- Minikube [Install from here](https://minikube.sigs.k8s.io/docs/start/)
The K8S setup currently is based on using Minikube for local fun. You can use the commands below from the root of the project:
```bash
minikube start
kubectl apply -f k8s/secrets-config.yml
kubectl apply -f k8s/secrets-secret.yml
kubectl apply -f k8s/challenge33.yml
kubectl apply -f k8s/secret-challenge-deployment.yml
while [[ $(kubectl get pods -l app=secret-challenge -o 'jsonpath={..status.conditions[?(@.type=="Ready")].status}') != "True" ]]; do echo "waiting for secret-challenge" && sleep 2; done
kubectl expose deployment secret-challenge --type=LoadBalancer --port=8080
minikube service secret-challenge
```
Alternatively you can do :
```bash
./k8s-vault-minkube-start.sh
```
now you can use the provided IP address and port to further play with the K8s variant (instead of localhost).
- [localhost:8080/challenge/challenge-5](http://localhost:8080/challenge/challenge-5)
- [localhost:8080/challenge/challenge-6](http://localhost:8080/challenge/challenge-6)
- [localhost:8080/challenge/challenge-33](http://localhost:8080/challenge/challenge-33)
### k8s based
Want to run vanilla on your own k8s? Use the commands below:
```bash
kubectl apply -f k8s/secrets-config.yml
kubectl apply -f k8s/secrets-secret.yml
kubectl apply -f k8s/challenge33.yml
kubectl apply -f k8s/secret-challenge-deployment.yml
while [[ $(kubectl get pods -l app=secret-challenge -o 'jsonpath={..status.conditions[?(@.type=="Ready")].status}') != "True" ]]; do echo "waiting for secret-challenge" && sleep 2; done
kubectl port-forward \
$(kubectl get pod -l app=secret-challenge -o jsonpath="{.items[0].metadata.name}") \
8080:8080
```
now you can use the provided IP address and port to further play with the K8s variant (instead of localhost).
- [localhost:8080/challenge/challenge-5](http://localhost:8080/challenge/challenge-5)
- [localhost:8080/challenge/challenge-6](http://localhost:8080/challenge/challenge-6)
- [localhost:8080/challenge/challenge-33](http://localhost:8080/challenge/challenge-33)
## Vault exercises with minikube
_Can be used for challenges 1-8, 12-46_
Make sure you have the following installed:
- minikube with docker (or comment out line 8 and work at your own k8s setup),
- docker,
- helm [Install from here](https://helm.sh/docs/intro/install/),
- kubectl [Install from here](https://kubernetes.io/docs/tasks/tools/),
- jq [Install from here](https://stedolan.github.io/jq/download/),
- vault [Install from here](https://www.vaultproject.io/downloads),
- grep, Cat, and Sed
Run `./k8s-vault-minkube-start.sh`, when the script is done, then the challenges will wait for you at <http://localhost:8080> . This will allow you to run challenges 1-8, 12-46.
When you stopped the `k8s-vault-minikube-start.sh` script and want to resume the port forward run: `k8s-vault-minikube-resume.sh`.
This is because if you run the start script again it will replace the secret in the vault and not update the secret-challenge application with the new secret.
## Cloud Challenges
_Can be used for challenges 1-46_
**READ THIS**: Given that the exercises below contain IAM privilege escalation exercises,
never run this on an account which is related to your production environment or can influence your account-over-arching
resources.
### Running WrongSecrets in AWS
Follow the steps in [the README in the AWS subfolder](aws/README.md).
### Running WrongSecrets in GCP
Follow the steps in [the README in the GCP subfolder](gcp/README.md).
### Running WrongSecrets in Azure
Follow the steps in [the README in the Azure subfolder](azure/README.md).
### Running Challenge15 in your own cloud only
When you want to include your own Canarytokens for your cloud-deployment, do the following:
1. Fork the project.
2. Make sure you use the [GCP ingress](/gcp/k8s-vault-gcp-ingress-start.sh) or [AWS ingress](aws/k8s-aws-alb-script.sh) scripts to generate an ingress for your project.
3. Go to [canarytokens.org](https://canarytokens.org/generate) and select `AWS Keys`, in the webHook URL field add `<your-domain-created-at-step1>/canaries/tokencallback`.
4. Encrypt the received credentials so that [Challenge15](/src/main/java/org/owasp/wrongsecrets/challenges/docker/Challenge15.java) can decrypt them again.
5. Commit the unencrypted and encrypted materials to Git and then commit again without the decrypted materials.
6. Adapt the hints of Challenge 15 in your fork to point to your fork.
7. Create a container and push it to your registry
8. Override the K8s definition files for either [AWS](/aws/k8s/secret-challenge-vault-deployment.yml) or [GCP](/gcp/k8s/secret-challenge-vault-deployment.yml.tpl).
## Do you want to play without guidance or spoils?
Each challenge has a `Show hints` button and a `What's wrong?` button. These buttons help to simplify the challenges and give explanation to the reader. Though, the explanations can spoil the fun if you want to do this as a hacking exercise.
Therefore, you can manipulate them by overriding the following settings in your env:
- `hints_enabled=false` will turn off the `Show hints` button.
- `reason_enabled=false` will turn of the `What's wrong?` explanation button.
- `spoiling_enabled=false` will turn off the `/spoil/challenge-x` endpoint (where `x` is the short-name of the challenge).
## Enabling Swaggerdocs and UI
You can enable Swagger documentation and the Swagger UI by overriding the `SPRINGDOC_UI` and `SPRINGDOC_DOC` when running the Docker container.
## Special thanks & Contributors
Leaders:
- [Ben de Haan @bendehaan](https://www.github.com/bendehaan)
- [Jeroen Willemsen @commjoen](https://www.github.com/commjoen)
Top contributors:
- [Jannik Hollenbach @J12934](https://www.github.com/J12934)
- [Puneeth Y @puneeth072003](https://www.github.com/puneeth072003)
- [Joss Sparkes @RemakingEden](https://www.github.com/RemakingEden)
Contributors:
- [Nanne Baars @nbaars](https://www.github.com/nbaars)
- [Marcin Nowak @drnow4u](https://www.github.com/drnow4u)
- [Rodolfo Cabral Neves @roddas](https://www.github.com/roddas)
- [Osama Magdy @osamamagdy](https://www.github.com/osamamagdy)
- [Divyanshu Dev @Novice-expert](https://www.github.com/Novice-expert)
- [Tibor Hercz @tiborhercz](https://www.github.com/tiborhercz)
- [za @za](https://www.github.com/za)
- [Chris Elbring Jr. @neatzsche](https://www.github.com/neatzsche)
- [Diamond Rivero @diamant3](https://www.github.com/diamant3)
- [Norbert Wolniak @nwolniak](https://www.github.com/nwolniak)
- [Adarsh A @adarsh-a-tw](https://www.github.com/adarsh-a-tw)
- [Shubham Patel @Shubham-Patel07](https://www.github.com/Shubham-Patel07)
- [Filip Chyla @fchyla](https://www.github.com/fchyla)
- [Turjo Chowdhury @turjoc120](https://www.github.com/turjoc120)
- [Vineeth Jagadeesh @djvinnie](https://www.github.com/djvinnie)
- [Dmitry Litosh @Dlitosh](https://www.github.com/Dlitosh)
- [Josh Grossman @tghosth](https://www.github.com/tghosth)
- [alphasec @alphasecio](https://www.github.com/alphasecio)
- [CaduRoriz @CaduRoriz](https://www.github.com/CaduRoriz)
- [Madhu Akula @madhuakula](https://www.github.com/madhuakula)
- [Mike Woudenberg @mikewoudenberg](https://www.github.com/mikewoudenberg)
- [Spyros @northdpole](https://www.github.com/northdpole)
- [RubenAtBinx @RubenAtBinx](https://www.github.com/RubenAtBinx)
- [Jeff Tong @Wind010](https://www.github.com/Wind010)
- [Fern @f3rn0s](https://www.github.com/f3rn0s)
- [Shlomo Zalman Heigh @szh](https://www.github.com/szh)
- [Rick M @kingthorin](https://www.github.com/kingthorin)
- [Nicolas Humblot @nhumblot](https://www.github.com/nhumblot)
- [Danny Lloyd @dannylloyd](https://www.github.com/dannylloyd)
- [Alex Bender @alex-bender](https://www.github.com/alex-bender)
Testers:
- [Dave van Stein @davevs](https://www.github.com/davevs)
- [Marcin Nowak @drnow4u](https://www.github.com/drnow4u)
- [Marc Chang Sing Pang @mchangsp](https://www.github.com/mchangsp)
- [Vineeth Jagadeesh @djvinnie](https://www.github.com/djvinnie)
Special thanks:
- [Madhu Akula @madhuakula @madhuakula](https://www.github.com/madhuakula)
- [Nanne Baars @nbaars @nbaars](https://www.github.com/nbaars)
- [Björn Kimminich @bkimminich](https://www.github.com/bkimminich)
- [Dan Gora @devsecops](https://www.github.com/devsecops)
- [Xiaolu Dai @saragluna](https://www.github.com/saragluna)
- [Jonathan Giles @jonathanGiles](https://www.github.com/jonathanGiles)
### Sponsorships
We would like to thank the following parties for helping us out:
[](https://blog.gitguardian.com/gitguardian-is-proud-sponsor-of-owasp/)
[GitGuardian](https://www.gitguardian.com/) for their sponsorship which allows us to pay the bills for our cloud-accounts.
[](https://www.jetbrains.com/)
[Jetbrains](https://www.jetbrains.com/) for licensing an instance of Intellij IDEA Ultimate edition to the project leads. We could not have been this fast with the development without it!
[](https://github.com/1Password/1password-teams-open-source/pull/552)
[1Password](https://1password.com/) for granting us an open source license to 1Password for the secret detection testbed.
[](https://aws.amazon.com/)
[AWS](https://aws.amazon.com/) for granting us AWS Open Source credits which we use to test our project and the [Wrongsecrets CTF Party](https://github.com/OWASP/wrongsecrets-ctf-party) setup on AWS.
## Help Wanted
You can help us by the following methods:
- Star us
- Share this app with others
- Of course, we can always use your help [to get more flavors](https://github.com/OWASP/wrongsecrets/issues/37) of "wrongly" configured secrets in to spread awareness! We would love to get some help with other cloud providers, like Alibaba or Tencent cloud for instance. Do you miss something else than a cloud provider? File an issue or create a PR! See [our guide on contributing for more details](CONTRIBUTING.md). Contributors will be listed in releases, in the "Special thanks & Contributors"-section, and the web-app.
## Use OWASP WrongSecrets as a secret detection benchmark
As tons of secret detection tools are coming up for both Docker and Git, we are creating a Benchmark testbed for it.
Want to know if your tool detects everything? We will keep track of the embedded secrets in [this issue](https://github.com/OWASP/wrongsecrets/issues/201) and have a [branch](https://github.com/OWASP/wrongsecrets/tree/experiment-bed) in which we put additional secrets for your tool to detect.
The branch will contain a Docker container generation script using which you can eventually test your container secret scanning.
## CTF
We have 3 ways of playing CTFs:
- The quick "let's play"-approach based on our own Heroku domain [https://wrongsecrets-ctf.herokuapp.com](https://wrongsecrets-ctf.herokuapp.com), which we documented for you here.
- A more extended approach documented in [ctf-instructions.md](/ctf-instructions.md).
- A fully customizable CTF setup where every player gets its own virtual instance of WrongSecrets and a virtual instance of the wrongsecrets-desktop, so they all can play hassle-free. For this you have to use [the WrongSecrets CTF Party setup](https://github.com/OWASP/wrongsecrets-ctf-party).
### CTFD Support
Want to use CTFD to play a CTF based on the free Heroku wrongsecrets-ctf instance together with CTFD? You can!
NOTE: CTFD support now works based on the [Juiceshop CTF CLI](https://github.com/juice-shop/juice-shop-ctf).
NOTE-II: [https://wrongsecrets-ctf.herokuapp.com](https://wrongsecrets-ctf.herokuapp.com) (temporary down based on lack of oss credits) is based on Heroku and has limited capacity.
Initial creation of the zip file for CTFD requires you to visit [https://wrongsecrets-ctf.herokuapp.com/api/Challenges](https://wrongsecrets-ctf.herokuapp.com/api/Challenges) once before executing the steps below.
Follow the following steps:
```shell
npm install -g juice-shop-ctf-cli@9.1.0
juice-shop-ctf #choose ctfd and https://wrongsecrets-ctf.herokuapp.com as domain. No trailing slash! The key is 'TRwzkRJnHOTckssAeyJbysWgP!Qc2T', feel free to enable hints. We do not support snippets or links/urls to code or hints.
docker run -p 8001:8000 -it ctfd/ctfd:3.4.3
```
Now visit the CTFD instance at [http://localhost:8001](http://localhost:8001) and setup your CTF.
Then use the administrative backup function to import the zipfile you created with the juice-shop-ctf command.
Game on using [https://wrongsecrets-ctf.herokuapp.com](https://wrongsecrets-ctf.herokuapp.com)!
Want to setup your own? You can! Watch out for people finding your key though, so secure it properly: make sure the running container with the actual ctf-key is not exposed to the audience, similar to our heroku container.
## FBCTF Support (Experimental!)
NOTE: FBCTF support is experimental.
Follow the same step as with CTFD, only now choose fbctfd and as a url for the countrymapping choose `https://raw.githubusercontent.com/OWASP/wrongsecrets/79a982558016c8ce70948a8106f9a2ee5b5b9eea/config/fbctf.yml`.
Then follow [https://github.com/facebookarchive/fbctf/wiki/Quick-Setup-Guide](https://github.com/facebookarchive/fbctf/wiki/Quick-Setup-Guide) to run the FBCTF.
## Notes on development
For development on local machine use the `local` profile `./mvnw spring-boot:run -Dspring-boot.run.profiles=local,without-vault`
If you want to test against vault without K8s: start vault locally with
```shell
export SPRING_CLOUD_VAULT_URI='http://127.0.0.1:8200'
export VAULT_API_ADDR='http://127.0.0.1:8200'
vault server -dev
```
and in your next terminal, do (with the token from the previous commands):
```shell
export SPRING_CLOUD_VAULT_URI='http://127.0.0.1:8200'
export SPRING_CLOUD_VAULT_TOKEN='<TOKENHERE>'
vault token create -id="00000000-0000-0000-0000-000000000000" -policy="root"
vault kv put secret/secret-challenge vaultpassword.password="$(openssl rand -base64 16)"
```
Now use the `local-vault` profile to do your development.
```shell
./mvnw spring-boot:run -Dspring-boot.run.profiles=local,local-vault
```
If you want to dev without a Vault instance, use additionally the `without-vault` profile to do your development:
```shell
./mvnw spring-boot:run -Dspring-boot.run.profiles=local,without-vault
```
Want to push a container? See `.github/scripts/docker-create-and-push.sh` for a script that generates and pushes all containers. Do not forget to rebuild the app before composing the container.
Want to check why something in vault is not working in kubernetes? Do `kubectl exec vault-0 -n vault -- vault audit enable file file_path=stdout`.
### Dependency management
We have CycloneDX and OWASP Dependency-check integrated to check dependencies for vulnerabilities.
You can use the OWASP Dependency-checker by calling `mvn dependency-check:aggregate` and `mvn cyclonedx:makeBom` to use CycloneDX to create an SBOM.
### Get the project started in IntelliJ IDEA
Requirements: make sure you have the following tools installed: [Docker](https://www.docker.com/products/docker-desktop/), [Java22 JDK](https://jdk.java.net/22/), [NodeJS 20](https://nodejs.org/en/download/current) and [IntelliJ IDEA](https://www.jetbrains.com/idea/download).
1. Fork and clone the project as described in the [documentation](https://github.com/OWASP/wrongsecrets/blob/master/CONTRIBUTING.md).
2. Import the project in IntelliJ (e.g. import as mvn project / local sources)
3. Go to the project settings and make sure it uses Java22 (And that the JDK can be found)
4. Go to the IDE settings>Language & Frameworks > Lombok and make sure Lombok processing is enabled
5. Open the Maven Tab in your IDEA and run "Reload All Maven Projects" to make the system sync and download everything. Next, in that same tab use the "install" option as part of the OWASP WrongSecrets Lifecycle to genereate the asciidoc and such.
6. Now run the `main` method in `org.owasp.wrongsecrets.WrongSecretsApplication.java`. This should fail with a stack trace.
7. Now go to the run configuration of the app and make sure you have the active profile `without-vault`. This is done by setting the VM options arguments to `--server.port=8080 --spring.profiles.active=local,without-vault`. Set `K8S_ENV=docker` as environment argument.
8. Repeat step 6: run the app again, you should have a properly running application which is visitable in your browser at http://localhost:8080.
**Pictorial Guide** on how to get the project started in IntelliJ IDEA is available at [_Contributing.md_](https://github.com/OWASP/wrongsecrets/blob/master/CONTRIBUTING.md#how-to-get-started-with-the-project-in-intellij-idea).
Feel free to edit and propose changes via pull requests. Be sure to follow our guidance in the [documentation](https://github.com/OWASP/wrongsecrets/blob/master/CONTRIBUTING.md) to get your work accepted.
Please note that we officially only support Linux and MacOS for development. If you want to develop using a Windows machine, use WSL2 or a virtual machine running Linux. We did include Windows detection & a bunch of `exe` files for a first experiment, but are looking for active maintainers of them. Want to make sure it runs on Windows? Create PRs ;-).
If, after reading this section, you still have no clue on the application code: Have a look [at some tutorials on Spring boot from Baeldung](https://www.baeldung.com/spring-boot).
### Automatic reload during development
To make changes made load faster we added `spring-dev-tools` to the Maven project.
To enable this in IntelliJ automatically, make sure:
- Under Compiler -> Automatically build project is enabled, and
- Under Advanced settings -> Allow auto-make to start even if developed application is currently running.
You can also manually invoke: Build -> Recompile the file you just changed, this will also force reloading of the application.
### How to add a Challenge
Follow the steps below on adding a challenge:
1. First make sure that you have an [Issue](https://github.com/OWASP/wrongsecrets/issues) reported for which a challenge is really wanted.
2. Add the new challenge in the `org.owasp.wrongsecrets.challenges` folder. Make sure you add an explanation in `src/main/resources/explanations` and refer to it from your new Challenge class.
3. Add unit, integration and UI tests as appropriate to show that your challenge is working.
4. Do not forget to configure the challenge in `src/main/resources/wrong-secrets-configuration.yaml`
5. Review the [CONTRIBUTING guide](CONTRIBUTING.md) for setting up your contributing environment and writing good commit messages.
For more details please refer [_Contributing.md_](https://github.com/OWASP/wrongsecrets/blob/master/CONTRIBUTING.md#how-to-add-a-challenge).
If you want to move existing cloud challenges to another cloud: extend Challenge classes in the `org.owasp.wrongsecrets.challenges.cloud` package and make sure you add the required Terraform in a folder with the separate cloud identified. Make sure that the environment is added to `org.owasp.wrongsecrets.RuntimeEnvironment`.
Collaborate with the others at the project to get your container running so you can test at the cloud account.
### Local testing
If you have made some changes to the codebase or added a new challenge and would like to see exactly how the container will look after merge for testing, we have a script that makes this very easy. Follow the steps below:
1. Ensure you have bash installed and open.
2. Navigate to .github/scripts.
3. Run the docker-create script `bash docker-create.sh`.
- Note: Do you want to run this on your minikube? then first run `eval $(minikube docker-env)`.
4. Follow any instructions given, you made need to install/change packages.
5. Run the newly created container:
- to running locally: `docker run -p 8080:8080 jeroenwillemsen/wrongsecrets:local-test-no-vault`
- to run it on your minikube: use the container `jeroenwillemsen/wrongsecrets:local-test-k8s-vault` in your deployment definition.
- to run it with Vault on your minikube: use the container `jeroenwillemsen/wrongsecrets:local-test-local-vault` in your deployment definition.
### Local Automated testing
We currently have 2 different test-suites, both fired with `./mvnw test`.
- A normal junit test suite of unit and integration tests, located at the [`test/java` folder](src/test/java) with output stored at the default target directory.
- A cypress test suite, integrated by means of a junit test, located at [`test/e2e` folder](src/test/e2e) with output stored at [`target/test-classes/e2e/cypress/reports/`](target/test-classes/e2e/cypress/reports/). See the [cypress readme](src/test/e2e/cypress/README.md) for more details.
Note: You can do a full roundtrip of cleaning, building, and testing with `./mvnw clean install`.
## Want to play, but are not allowed to install the tools?
If you want to play the challenges, but cannot install tools like keepass, Radare, etc. But are allowed to run Docker containers, try the following:
```shell
docker run -p 3000:3000 -v /var/run/docker.sock:/var/run/docker.sock jeroenwillemsen/wrongsecrets-desktop:latest
```
or use something more configurable:
```shell
docker run -d \
--name=webtop \
--security-opt seccomp=unconfined \
-e PUID=1000 \
-e PGID=1000 \
-e TZ=Europe/London \
-e SUBFOLDER=/ \
-e KEYBOARD=en-us-qwerty \
-p 3000:3000 \
-v /var/run/docker.sock:/var/run/docker.sock \
--shm-size="2gb" \
--restart unless-stopped \
jeroenwillemsen/wrongsecrets-desktop:latest
```
And then at [http://localhost:3000](http://localhost:3000).
Note: be careful with trying to deploy the `jeroenwillemsen/wrongsecrets-desktop` container to Heroku ;-).
## Docker on macOS with M1 and Colima (Experimental!)
NOTE: Colima support is experimental.
Using [Colima](https://github.com/abiosoft/colima) (version 0.5.2 when written) you your macOS with Apple Silicon M1
to run Docker image `jeroenwillemsen/wrongsecrets` you try one of:
- switch off Colima
- change Docker context
- run Colima with 1 CPU
### Switch off Colima
```shell
colima stop
```
and run natively Docker image `jeroenwillemsen/wrongsecrets` on ARM.
### Change Docker context
Running docker image on Colima container runtimes on macOS Ventura with M1 CPU can run very slowly or can hang at some point.
Wrong Secrets provide `arm64` Docker image and switching to `desktop-linux` context will use the native `arm64` image.
To do that in the terminal run:
```shell
docker context ls
```
you should see context default `colima *`:
```
NAME TYPE DESCRIPTION DOCKER ENDPOINT KUBERNETES ENDPOINT ORCHESTRATOR
colima * moby colima unix:///Users/YOUR_USER_NAME/.colima/default/docker.sock
default moby Current DOCKER_HOST based configuration unix:///var/run/docker.sock https://127.0.0.1:6443 (default) swarm
desktop-linux moby unix:///Users/YOUR_USER_NAME/.docker/run/docker.sock
```
Now run one of the above Docker commands together with `--context` switch e.g.:
```bash
docker --context desktop-linux run -p 8080:8080 jeroenwillemsen/wrongsecrets:latest-no-vault
```
### Run Colima with 1 CPU
Colima is using QEMU behind and for QEMU on Apple Silicon M1 is recommended to use 1 CPU core:
```shell
colima start -m 8 -c 1 --arch x86_64
```
and run with AMD x64 emulation e.g.:
```bash
docker run -p 8080:8080 jeroenwillemsen/wrongsecrets:latest-no-vault
```
## Want to disable challenges in your own release?
If you want to run WrongSecrets but without certain challenges you don't want to present to others: please read this section.
*_NOTE_* Please note that we do not deliver any support to your fork when you follow the process below. Please understand that license and copyright of the original application remain intact for your Fork.
Requirements:
- Have the JDK of Java 22 installed;
- Have an account at a registry to which you can push your variant of the WrongSecrets container;
Here are the steps you have to follow to create your own release of WrongSecrets with certain challenges disabled:
1. Fork the repository.
2. In `src/main/resources/wrong-secrets-configuration.yaml` remove the reference to the challenge you no longer want to have in your fork.
3. In the root of the project run `./mvnw clean install`
4. Now build the Docker image for your target of choice:
```sh
docker buildx create --name mybuilder
docker buildx use mybuilder
docker buildx build --platform linux/amd64,linux/arm64 -t <registry/container-name>:<yourtag>-no-vault --build-arg "argBasedPassword='this is on your command line'" --build-arg "PORT=8081" --build-arg "argBasedVersion=<yourtag>" --build-arg "spring_profile=without-vault" --push
docker buildx build --platform linux/amd64,linux/arm64 -t <registry/container-name>:<yourtag>-kubernetes-vault--build-arg "argBasedPassword='this is on your command line'" --build-arg "PORT=8081" --build-arg "argBasedVersion=<yourtag>" --build-arg "spring_profile=kubernetes-vault" --push
```
## Further reading on secrets management
Want to learn more? Checkout the sources below:
- [Blog: 10 Pointers on Secrets Management](https://dev.to/commjoen/secure-deployment-10-pointers-on-secrets-management-187j)
- [OWASP SAMM on Secret Management](https://owaspsamm.org/model/implementation/secure-deployment/stream-b/)
- [The secret detection topic at Github](https://github.com/topics/secrets-detection)
- [OWASP Secretsmanagement Cheatsheet](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Secrets_Management_Cheat_Sheet.md)
- [OpenCRE on secrets management](https://www.opencre.org/cre/223-780?register=true&type=tool&tool_type=training&tags=secrets,training&description=With%20this%20app%2C%20we%20have%20packed%20various%20ways%20of%20how%20to%20not%20store%20your%20secrets.%20These%20can%20help%20you%20to%20realize%20whether%20your%20secret%20management%20is%20ok.%20The%20challenge%20is%20to%20find%20all%20the%20different%20secrets%20by%20means%20of%20various%20tools%20and%20techniques.%20Can%20you%20solve%20all%20the%2014%20challenges%3F&trk=flagship-messaging-web&messageThreadUrn=urn:li:messagingThread:2-YmRkNjRkZTMtNjRlYS00OWNiLWI2YmUtMDYwNzY3ZjI1MDcyXzAxMg==&lipi=urn:li:page:d_flagship3_feed;J58Sgd80TdanpKWFMH6z+w==)
| 0 |
kakajika/FragmentAnimations | 3D animation examples for support-v4 Fragment transition. | null | # FragmentAnimations
[](http://developer.android.com/index.html)
<img src="https://img.shields.io/badge/license-Apache 2.0-green.svg?style=flat">
[](https://android-arsenal.com/api?level=4)
[](https://android-arsenal.com/details/1/3526)
Animation examples for `support.v4.Fragment` transition.
These animations do not depends on any external libraries.
[<img src="https://dply.me/h7azvd/button/large" alt="Try it on your device via DeployGate">](https://dply.me/h7azvd)
## Usage Example
In your `Fragment`, just code like this.
```java
@Override
public Animation onCreateAnimation(int transit, boolean enter, int nextAnim) {
return CubeAnimation.create(CubeAnimation.UP, enter, DURATION);
}
```
See more example in [ExampleFragment.java](https://github.com/kakajika/FragmentAnimations/blob/master/app/src/main/java/com/labo/kaji/fragmentanimations/example/ExampleFragment.java)
## Contents
### Cube Animation
[CubeAnimation.java](https://github.com/kakajika/FragmentAnimations/blob/master/fragmentanimations/src/main/java/com/labo/kaji/fragmentanimations/CubeAnimation.java)

### Flip Animation
[FlipAnimation.java](https://github.com/kakajika/FragmentAnimations/blob/master/fragmentanimations/src/main/java/com/labo/kaji/fragmentanimations/FlipAnimation.java)

### Push/Pull Animation
[PushPullAnimation.java](https://github.com/kakajika/FragmentAnimations/blob/master/fragmentanimations/src/main/java/com/labo/kaji/fragmentanimations/PushPullAnimation.java)

### Sides Animation
[SidesAnimation.java](https://github.com/kakajika/FragmentAnimations/blob/master/fragmentanimations/src/main/java/com/labo/kaji/fragmentanimations/SidesAnimation.java)
### Move Animation
[MoveAnimation.java](https://github.com/kakajika/FragmentAnimations/blob/master/fragmentanimations/src/main/java/com/labo/kaji/fragmentanimations/MoveAnimation.java)

## Combination
You can use above Animations with another one.
```java
@Override
public Animation onCreateAnimation(int transit, boolean enter, int nextAnim) {
if (enter) {
return MoveAnimation.create(MoveAnimation.UP, enter, DURATION);
} else {
return CubeAnimation.create(CubeAnimation.UP, enter, DURATION);
}
}
```
### Cube/Move Animation

### Move/Cube Animation

### Push/Move Animation

### Move/Pull Animation

## Install
This library is available in jcenter.
```groovy
dependencies {
compile 'com.labo.kaji:fragmentanimations:0.1.1'
}
```
## License
Copyright 2015 kakajika
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
| 0 |
eazybytes/microservices | Microservices With Spring, Docker, Kubernetes - Code Examples | docker docker-compose java kubernetes microservice spring spring-boot spring-cloud | # Master Microservices with Spring Boot, Docker, Kubernetes
[](https://www.udemy.com/course/master-microservices-with-spring-docker-kubernetes/?referralCode=9365DB9B7EE637F629A9)
Learn how to create enterprise and production ready Microservices with Spring, Spring Cloud, Docker and Kubernetes.
## Topics covered in the course
* Section 1 - Introduction to Microservices Architecture
* Section 2- Building microservices using Spring Boot
* Section 3 - How do we right size our microservices & identify boundaries
* Section 4 - Handle deployment, portability & scalability of microservices using Docker
* Section 5 - Deep Dive on Cloud Native Apps & 15-Factor methodology
* Section 6 - Configurations Management in Microservices
* Section 7 - Using MySQL DBs inside microservices
* Section 8 - Service Discovery & Service Registration in microservices
* Section 9 - Gateway, Routing & Cross cutting concerns in Microservices
* Section 10 - Making Microservices Resilient
* Section 11 - Observability and monitoring of microservices
* Section 12 - Microservices Security
* Section 13 - Event Driven microservices using RabbitMQ,Spring Cloud Functions & Stream
* Section 14 - Event Driven microservices using Kafka,Spring Cloud Functions & Stream
* Section 15 - Container Orchestration using Kubernetes
* Section 16 - Deep dive on Helm
* Section 17 - Server-side service discovery and load balancing using Kubernetes
* Section 18 - Deploying microservices into cloud K8s cluster
* Section 19 - Introduction to K8s Ingress, Service Mesh (Istio) & mTLS
* Section 20 - Congratulations & Thank You
## Pre-requisite for the course
- Good understanding on Java and Spring concepts
- Basic understanding on SpringBoot & REST services is a bonus but not mandatory
- Interest to learn and explore about Microservices
# Important Links
- Spring Boot - https://spring.io/projects/spring-boot
- Create SpringBoot project - https://start.spring.io
- DTO pattern blog - https://martinfowler.com/eaaCatalog/dataTransferObject.html
- Model Mapper - http://modelmapper.org/
- Map Struct - https://mapstruct.org/
- Spring Doc - https://springdoc.org/
- Open API - https://www.openapis.org/
- Lucidchart Blog - https://www.lucidchart.com/blog/ddd-event-storming
- Docker website - https://www.docker.com
- Docker hub website - https://hub.docker.com
- Buildpacks website - https://buildpacks.io
- Google Jib website - https://github.com/GoogleContainerTools/jib
- Docker compose website - https://docs.docker.com/compose/
- Twelve-Factor methodology - https://12factor.net
- Beyond the Twelve-Factor App book - https://www.oreilly.com/library/view/beyond-the-twelve-factor/9781492042631/
- Spring Cloud website - https://spring.io/projects/spring-cloud
- Spring Cloud Config website - https://spring.io/projects/spring-cloud-config
- Spring Cloud Bus website - https://spring.io/projects/spring-cloud-bus
- RabbitMQ website - https://www.rabbitmq.com
- Hookdeck website- https://hookdeck.com
- Spring Cloud Netflix website - https://spring.io/projects/spring-cloud-netflix
- Spring Cloud OpenFeign - https://spring.io/projects/spring-cloud-openfeign
- Netflix Blog - https://netflixtechblog.com/netflix-oss-and-spring-boot-coming-full-circle-4855947713a0
- Resilience4j website - https://resilience4j.readme.io
- Spring Cloud Gateway website - https://spring.io/projects/spring-cloud-gateway
- Stripe RateLimitter pattern blog - https://stripe.com/blog/rate-limiters
- Apache Benchmark website - https://httpd.apache.org
- Grafana website - https://grafana.com
- Grafana Loki setup - https://grafana.com/docs/loki/latest/getting-started/
- Micrometer website - https://micrometer.io
- Prometheus website - https://prometheus.io/
- Grafana Dashboards - https://grafana.com/grafana/dashboards/
- OpenTelemetry website - https://opentelemetry.io/
- OpenTelemetry automatic instrumentation - https://opentelemetry.io/docs/instrumentation/java/automatic/
- Keycloak website - https://www.keycloak.org/
- Apache Kafka website - https://kafka.apache.org
- Docker compose file for Kafka - https://github.com/bitnami/containers/blob/main/bitnami/kafka/docker-compose.yml
- Local Kubernetes Cluster with Docker Desktop - https://docs.docker.com/desktop/kubernetes/
- Kubernetes Dashboard - https://kubernetes.io/docs/tasks/access-application-cluster/web-ui-dashboard/
- Helm website - https://helm.sh
- Chocolatey website - https://chocolatey.org/
- Bitnami Helm charts GitHub repo - https://github.com/bitnami/charts
- Spring Cloud Kubernetes website - https://spring.io/projects/spring-cloud-kubernetes
- Spring Cloud Kubernetes Blog - https://spring.io/blog/2021/10/26/new-features-for-spring-cloud-kubernetes-in-spring-cloud-2021-0-0-m3
- GCP website - https://cloud.google.com
- GCP SDK installation - https://cloud.google.com/sdk/docs/install
- Kubernetes Ingress - https://kubernetes.io/docs/concepts/services-networking/ingress/
- Ingress Controllers - https://kubernetes.io/docs/concepts/services-networking/ingress-controllers/
- Istio (Service mesh) - https://istio.io
## Maven Commands used in the course
| Maven Command | Description |
| ------------- | ------------- |
| "mvn clean install -Dmaven.test.skip=true" | To generate a jar inside target folder |
| "mvn spring-boot:run" | To start a springboot maven project |
| "mvn spring-boot:build-image" | To generate a docker image using Buildpacks. No need of Dockerfile |
| "mvn compile jib:dockerBuild" | To generate a docker image using Google Jib. No need of Dockerfile |
## Docker Commands used in the course
| Docker Command | Description |
| ------------- | ------------- |
| "docker build . -t eazybytes/accounts:s4" | To generate a docker image based on a Dockerfile |
| "docker run -p 8080:8080 eazybytes/accounts:s4" | To start a docker container based on a given image |
| "docker images" | To list all the docker images present in the Docker server |
| "docker image inspect image-id" | To display detailed image information for a given image id |
| "docker image rm image-id" | To remove one or more images for a given image ids |
| "docker image push docker.io/eazybytes/accounts:s4" | To push an image or a repository to a registry |
| "docker image pull docker.io/eazybytes/accounts:s4" | To pull an image or a repository from a registry |
| "docker ps" | To show all running containers |
| "docker ps -a" | To show all containers including running and stopped |
| "docker container start container-id" | To start one or more stopped containers |
| "docker container pause container-id" | To pause all processes within one or more containers |
| "docker container unpause container-id" | To unpause all processes within one or more containers |
| "docker container stop container-id" | To stop one or more running containers |
| "docker container kill container-id" | To kill one or more running containers instantly |
| "docker container restart container-id" | To restart one or more containers |
| "docker container inspect container-id" | To inspect all the details for a given container id |
| "docker container logs container-id" | To fetch the logs of a given container id |
| "docker container logs -f container-id" | To follow log output of a given container id |
| "docker container rm container-id" | To remove one or more containers based on container ids |
| "docker container prune" | To remove all stopped containers |
| "docker compose up" | To create and start containers based on given docker compose file |
| "docker compose down" | To stop and remove containers |
| "docker compose start" | To start containers based on given docker compose file |
| "docker compose down" | To stop the running containers |
| "docker run -p 3306:3306 --name accountsdb -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=accountsdb -d mysql" | To create a MySQL DB container |
| "docker run -p 6379:6379 --name eazyredis -d redis" | To create a Redis Container |
| "docker run -p 8080:8080 -e KEYCLOAK_ADMIN=admin -e KEYCLOAK_ADMIN_PASSWORD=admin quay.io/keycloak/keycloak:22.0.3 start-dev" | To create Keycloak Container|
## Apache Benchmark command used in the course
| Apache Benchmark command | Description |
| ------------- | ------------- |
| "ab -n 10 -c 2 -v 3 http://localhost:8072/eazybank/cards/api/contact-info" | To perform load testing on API by sending 10 requests |
## Kubernetes Commands used in the course
| Kubernetes Command | Description |
| ------------- | ------------- |
| "kubectl apply -f filename" | To create a deployment/service/configmap based on a given YAML file |
| "kubectl get all" | To get all the components inside your cluster |
| "kubectl get pods" | To get all the pods details inside your cluster |
| "kubectl get pod pod-id" | To get the details of a given pod id |
| "kubectl describe pod pod-id" | To get more details of a given pod id |
| "kubectl delete pod pod-id" | To delete a given pod from cluster |
| "kubectl get services" | To get all the services details inside your cluster |
| "kubectl get service service-id" | To get the details of a given service id |
| "kubectl describe service service-id" | To get more details of a given service id |
| "kubectl get nodes" | To get all the node details inside your cluster |
| "kubectl get node node-id" | To get the details of a given node |
| "kubectl get replicasets" | To get all the replica sets details inside your cluster |
| "kubectl get replicaset replicaset-id" | To get the details of a given replicaset |
| "kubectl get deployments" | To get all the deployments details inside your cluster |
| "kubectl get deployment deployment-id" | To get the details of a given deployment |
| "kubectl get configmaps" | To get all the configmap details inside your cluster |
| "kubectl get configmap configmap-id" | To get the details of a given configmap |
| "kubectl get events --sort-by=.metadata.creationTimestamp" | To get all the events occured inside your cluster |
| "kubectl scale deployment accounts-deployment --replicas=1" | To set the number of replicas for a deployment inside your cluster |
| "kubectl set image deployment gatewayserver-deployment gatewayserver=eazybytes/gatewayserver:s11 --record" | To set a new image for a deployment inside your cluster |
| "kubectl rollout history deployment gatewayserver-deployment" | To know the rollout history for a deployment inside your cluster |
| "kubectl rollout undo deployment gatewayserver-deployment --to-revision=1" | To rollback to a given revision for a deployment inside your cluster |
| "kubectl get pvc" | To list the pvcs inside your cluster |
| "kubectl delete pvc data-happy-panda-mariadb-0" | To delete a pvc inside your cluster |
## Helm Commands used in the course
| Helm Command | Description |
| ------------- | ------------- |
| "helm create [NAME]" | Create a default chart with the given name |
| "helm dependencies build" | To recompile the given helm chart |
| "helm install [NAME] [CHART]" | Install the given helm chart into K8s cluster |
| "helm upgrade [NAME] [CHART]" | Upgrades a specified release to a new version of a chart |
| "helm history [NAME]" | Display historical revisions for a given release |
| "helm rollback [NAME] [REVISION]" | Roll back a release to a previous revision |
| "helm uninstall [NAME]" | Uninstall all of the resources associated with a given release |
| "helm template [NAME] [CHART]" | Render chart templates locally along with the values |
| "helm list" | Lists all of the helm releases inside a K8s cluster |
| 0 |
ouya/ouya-sdk-examples | Examples for ouya sdk engines | null | ouya-sdk-examples
=================
This repository holds the code for various engines for interacting with the OUYA ODK.
Refer to the <a target=_blank href="https://devs.ouya.tv/developers/docs">[OUYA Docs]</a> for a table of content and guides for these examples.
Contributions to the OUYA Docs are submitted <a target=_blank href="https://github.com/ouya/docs">[here]</a>.
| 0 |
afrunt/examples | null | null | # examples
## Spring Boot / Spring Cloud
* [Clustered Spring Boot Admin with Kubernetes Service Discovery](https://github.com/afrunt/examples/tree/master/spring-boot/spring-boot-admin-k8s)
* [Spring Boot and Elastic APM. SQL, JMS and custom spans](https://github.com/afrunt/examples/tree/master/spring-boot/spring-boot-elastic-apm)
## Java EE 8
* [Java EE 8. How to integrate Java EE 8 application with NEO4j graph database](https://github.com/afrunt/examples/tree/master/java-ee-8-examples/neo4j-integration)
* [Java EE 8. How to implement custom scheduling with CDI and Concurrency Utilities](https://github.com/afrunt/examples/tree/master/java-ee-8-examples/cdi-managed-scheduling)
| 0 |
eventuate-examples/eventuate-examples-java-spring-todo-list | A Java and Spring Boot Todo list application built using Eventuate | null | # An Eventuate project
<img class="img-responsive" src="https://eventuate.io/i/logo.gif">
This project is part of [Eventuate](http://eventuate.io), which is a microservices collaboration platform.
# Todo List example application
The Todo List application is the hello world application for the [Eventuate™ event sourcing](http://eventuate.io).
It illustrates how you can use the platform to write an application with a [microservices architecture](http://microservices.io/patterns/microservices.html) that uses [Event Sourcing](http://microservices.io/patterns/data/event-sourcing.html) and [Command Query Responsibility Segregation (CQRS)](http://microservices.io/patterns/data/cqrs.html).
The Todo List application lets users maintain a todo list.
The Todo List application is a Java and Spring Boot application built using Eventuate™'s Event Sourcing based programming model.
Todos are implemented by an Event Sourcing-based `TodoAggregate`.
The aggregate's events are persisted in the Eventuate event store.
The application also maintains a materialized view of the data in MySQL.
Don't forget to take a look at the other [Eventuate example applications](http://eventuate.io/exampleapps.html).
# Got questions?
Don't hesitate to create an issue or see
* [Website](http://eventuate.io)
* [Mailing list](https://groups.google.com/d/forum/eventuate-users)
* [Slack](https://eventuate-users.slack.com). [Get invite](https://eventuateusersslack.herokuapp.com/)
* [Contact us](http://eventuate.io/contact.html).
# Architecture
The Todo application has a microservice architecture.
It is written using the [Eventuate Client Framework for Java](http://eventuate.io/docs/java/eventuate-client-framework-for-java.html), which provides an [event sourcing based programming model](http://eventuate.io/whyeventsourcing.html).
The following diagram shows the Todo List application architecture:
<img class="img-responsive" src="i/eventuate-todo-architecture.png">
The application consists of the following:
* Todo service - a Java and Spring Boot-based service that has a HATEOAS-style REST API for creating, updating and querying todo list items.
It uses Eventuate to persist aggregates using event sourcing.
* Todo view service - a Java and Spring Boot-based service that provides a REST API for querying todos.
It implements a [Command Query Responsibility Segregation (CQRS)](http://microservices.io/patterns/data/cqrs.html) view of todos using MySQL.
MySQL is kept up to date by subscribing to events produced by the Todo service.
* MySQL database - stores the CQRS view of todo list items.
Note: for simplicity, the Todo list application can be deployed as a monolithic application.
# Building and running the application
First, build the application
```
./gradlew assemble
```
Next, launch the services using [Docker Compose](https://docs.docker.com/compose/):
```
export DOCKER_HOST_IP=...
./gradlew <database-mode>ComposeBuild
./gradlew <database-mode>ComposeUp
```
Where `database-mode` is one of:
* `mysqlbinlog` - use MySQL with Binlog-based event publishing
* `postgreswal` - use Postgres with Postgres WAL-based event publishing
* `postgrespolling` - use Postgres with generic JDBC polling-based event publishing
Note: You need to set `DOCKER_HOST_IP` before running Docker Compose.
This must be an IP address or resolvable hostname.
It cannot be `localhost`.
See this [guide to setting `DOCKER_HOST_IP`](http://eventuate.io/docs/usingdocker.html) for more information.
# Using the application
Once the application has started, you can use the application via the Swagger UI.
* `http://${DOCKER_HOST_IP}:8081/swagger-ui.html` - the command-side service
* `http://${DOCKER_HOST_IP}:8082/swagger-ui.html` - the query-side service
# Got questions?
Don't hesitate to create an issue or see
* [Website](http://eventuate.io)
* [Mailing list](https://groups.google.com/d/forum/eventuate-users)
* [Slack](https://eventuate-users.slack.com). [Get invite](https://eventuateusersslack.herokuapp.com/)
* [Contact us](http://eventuate.io/contact.html).
| 0 |
inductiveautomation/ignition-sdk-examples | Ignition SDK Example Projects | null | null | 1 |
vaadin/addressbook | Simple Addressbook example application | null | Addressbook Tutorial
====================
This tutorial teaches you some of the basic concepts in [Vaadin Framework](https://vaadin.com). It is meant to be
a fast read for learning how to get started - not an example on how application should be
designed. Please note this example uses and requires Java 8 to work.

Running the example from the command line
-------------------
```
$ mvn jetty:run
```
Open [http://localhost:8080/](http://localhost:8080/)
Importing in IntelliJ IDEA 14
--------------------
These instructions were tested on IntelliJ IDEA 14 CE. You can get it from https://www.jetbrains.com/idea/
To get the project up and running in IDEA, do:
- File -> New -> Project from Version Control -> Git
- The URL to use is https://github.com/vaadin/addressbook.git
- If you get a message about "Non-managed pom.xml file found". Choose "Add as Maven Project"
- If you get a message about no JDK or SDK being selected. Choose "Configure" and select your installed JDK. You can also set the JDK using File -> Project Structure
- To start the project, find the "Maven Projects" tab on the right hand side of the screen and navigate to
- Vaadin Web Application -> Plugins -> jetty -> jetty:run
- Click the play button or right click and select Run (Select Debug instead to run in debug mode)
You should now have a Jetty server running on localhost:8080. Navigate to http://localhost:8080 to play with the application
Importing in NetBeans 8
--------------------
These instructions were tested on NetBeans 8.0.2. You can get it from https://www.netbeans.org
To checkout and run the project in NetBeans, do:
- Team -> Git -> Clone
- Set repository URL to https://github.com/vaadin/addressbook.git
- Finish
- Right click the imported project (Vaadin Addressbook Application) and select Run
- Select GlassFish Server 4.1 -> Remember in Current IDE Session -> OK
You should now have a GlassFish server running on localhost:8080 and a browser tab should also be automatically opened with this location
Importing in Eclipse
--------------------
These instructions were tested on Eclipse IDE for Java EE Developers Luna SR2. You can get it from http://eclipse.org/downloads/
To checkout and run the project in Eclipse, do:
- File -> Import...
- Check out Maven Projects from SCM
- Choose Git from SCM menu
- If you do not see "Git" in the SCM menu, click "Find more SCM connectors in the m2e Marketplace" and install "m2e-egit". Restart Eclipse and start over.
- Set the repository URL to https://github.com/vaadin/addressbook.git
- Right click the imported "addressbook" and choose Run As -> Maven Build...
- Set the goal to "jetty:run" and click "Run"
You should now have a Jetty server running on localhost:8080. Navigate to [http://localhost:8080/](http://localhost:8080/) to play with the application
To use the built in server adapters of Eclipse, instead of doing "Run As -> Maven Build..." you can do
- Run As -> Run on Server
- Select the server you want to run on, e.g. Apache Tomcat 8 and click ok
- *Do not use the suggested J2EE Preview server* as it is outdated, deprecated and does not support Servlet 3, which is required for this application
| 1 |
apache/camel-quarkus-examples | Apache Camel Quarkus Examples | camel integration java quarkus | null | 0 |
JVerstry/Web-Related-Examples | null | null | Web-Related-Examples
====================
A set of web related examples from http://tshikatshikaaa.blogspot.com | 0 |
kite-sdk/kite-examples | Kite SDK Examples | null | # Kite SDK Examples
The Kite Examples project provides examples of how to use the Kite SDK.
Each example is a standalone Maven module with associated documentation.
## Basic Examples
* `dataset` is the closest to a HelloWorld example of Kite. It shows how to create datasets and perform streaming writes and reads over them.
* `dataset-hbase` shows how to store entities in HBase using the `RandomAccessDataset` API.
* `dataset-staging` shows how to use two datasets to manage Parquet-formatted data
* `logging` is an example of logging events from a command-line programs to Hadoop via Flume, using log4j as the logging API.
* `logging-webapp` is like `logging`, but the logging source is a webapp.
## Advanced Examples
* `demo` is a full end-to-end example of a webapp that logs events using Flume and performs session analysis using Crunch and Hive.
## Getting Started
The easiest way to run the examples is on the
[Cloudera QuickStart VM](http://www.cloudera.com/content/support/en/downloads/quickstart_vms.html),
which has all the necessary Hadoop services pre-installed, configured, and
running locally. See the notes below for any initial setup steps you should take.
The current examples run on version 5.1.0 of the QuickStart VM.
Checkout the latest [branch](https://github.com/kite-sdk/kite-examples/branches) of this repository in the VM:
```bash
git clone git://github.com/kite-sdk/kite-examples.git
cd kite-examples
```
Then choose the example you want to try and refer to the README in the relevant subdirectory.
### Setting up the QuickStart VM
There are two ways to run the examples with the QuickStart VM:
1. Logged in to the VM guest (username and password are both `cloudera`).
2. From your host computer.
The advantage of the first approach is that you don't need to install anything extra on
your host computer, such as Java or Maven, so there are no fewer set up steps.
For either approach, you need to make the following changes while logged into the VM:
* __Sync the system clock__ For some of the examples it's important that the host and
guest times are in sync. To synchronize the guest, login and type
`sudo ntpdate pool.ntp.org`.
* __Configure the NameNode to listen on all interfaces__ In order to access the cluster from
the host computer, the NameNode must be configured to listen on all network interfaces. This
is done by setting the `dfs.namenode.rpc-bind-host` property in `/etc/hadoop/conf/hdfs-site.xml`:
```xml
<property>
<name>dfs.namenode.rpc-bind-host</name>
<value>0.0.0.0</value>
</property>
```
* __Configure the History Server to listen on all interfaces__ In order to access the
cluster from the host computer, the History Server must be configured to listen on all
network interfaces. This is done by setting the `mapreduce.jobhistory.address` property
in `/etc/hadoop/conf/mapred-site.xml`:
```xml
<property>
<name>mapreduce.jobhistory.address</name>
<value>0.0.0.0:10020</value>
</property>
```
* __Configure HBase to listen on all interfaces__ In order to access the cluster from
the host computer, HBase must be configured to listen on all network interfaces. This
is done by setting the `hbase.master.ipc.address` and `hbase.regionserver.ipc.address`
properties in `/etc/hbase/conf/hbase-site.xml`:
```xml
<property>
<name>hbase.master.ipc.address</name>
<value>0.0.0.0</value>
</property>
<property>
<name>hbase.regionserver.ipc.address</name>
<value>0.0.0.0</value>
</property>
```
* __Restart the vm__ Restart the VM with `sudo shutdown -r now`
The second approach is preferable when you want to use tools from your own development
environment (browser, IDE, command line). However, there are a few extra steps you
need to take to configure the QuickStart VM, listed below:
* __Add a host entry for quickstart.cloudera__ Add or edit a line like the following
in `/etc/hosts` on the host machine
```
127.0.0.1 localhost.localdomain localhost quickstart.cloudera
```
* __Enable port forwarding__ Most of the ports that need to be forward are pre-configured
on the QuickStart VM, but there are few that we need to add. For VirtualBox, open
the Settings dialog for the VM, select the Network tab, and click the Port Forwarding
button. Map the following ports - in each case the host port and the guest port
should be the same. Also, your VM should not be running when you are making these changes.
* 8032 (YARN ResourceManager)
* 10020 (MapReduce JobHistoryServer)
If you have VBoxManage installed on your host machine, you can do this via
command line as well. In bash, this would look something like:
```bash
# Set VM_NAME to the name of your VM as it appears in VirtualBox
VM_NAME="QuickStart VM"
PORTS="8032 10020"
for port in $PORTS; do
VBoxManage modifyvm "$VM_NAME" --natpf1 "Rule $port,tcp,,$port,,$port"
done
```
## Running integration tests
Some of the examples include integration tests. You can run them all with the following
command:
```bash
for module in $(ls -d -- */); do
(cd $module; mvn clean verify; if [ $? -ne 0 ]; then break; fi)
done
```
# Troubleshooting
## Working with the VM
* __What are the usernames/passwords for the VM?__
* Cloudera manager: cloudera/cloudera
* HUE: cloudera/cloudera
* Login: cloudera/cloudera
* __I can't find the file in VirtualBox (or VMWare)!__
* You probably need to unpack it: In Windows, install 7zip, and _extract_ the
VM files from the `.7z` file. In linux or mac, `cd` to where you copied the
file and run `7zr e cloudera-quickstart-vm-4.3.0-kite-vbox-4.4.0.7z`
* You should be able to import the extracted files to VirtualBox or VMWare
* __How do I open a `.ovf` file?__
* Install and open [VirtualBox][vbox] on your computer
* Under the menu "File", select "Import..."
* Navigate to where you unpacked the `.ovf` file and select it
* __What is a `.vmdk` file?__
* The `.vmdk` file is the virtual machine disk image that accompanies a
`.ovf` file, which is a portable VM description.
* __How do I open a `.vbox` file?__
* Install and open [VirtualBox][vbox] on your computer
* Under the menu "Machine", select "Add..."
* Navigate to where you unpacked the `.vbox` file and select it
* __How do I fix "VTx" errors?__
* Reboot your computer and enter BIOS
* Find the "Virtualization" settings, usually under "Security" and _enable_
all of the virtualization options
* __How do I get my mouse back?__
* If your mouse/keyboard is stuck in the VM (captured), you can usually
release it by pressing the right `CTRL` key. If you don't have one (or that
didn't work), then the release key will be in the __lower-right__ of the
VirtualBox window
* __Other problems__
* Using VirtualBox? Try using VMWare.
* Using VMWare? Try using VirtualBox.
[vbox]: https://www.virtualbox.org/wiki/Downloads
| 0 |
aspose-words/Aspose.Words-for-Java | Aspose.Words for Java examples, plugins and showcases | null |  
# Java API for Various Document Formats
[Aspose.Words for Java](https://products.aspose.com/words/java) is an advanced Java Word processing API that enables you to perform a great range of document processing tasks directly within your Java applications. Aspose.Words for Java API supports processing word (DOC, DOCX, OOXML, RTF) HTML, OpenDocument, PDF, EPUB, XPS, SWF and all image formats. With Aspose.Words you can generate, modify, and convert documents without using Microsoft Word.
Directory | Description
--------- | -----------
[Examples](Examples) | A collection of Java examples that help you learn the product features.
[Plugins](Plugins) | Plugins that will demonstrate one or more features of Aspose.Words for Java.
<p align="center">
<a title="Download Examples ZIP" href="https://github.com/aspose-words/Aspose.words-for-Java/archive/master.zip">
<img src="https://raw.github.com/AsposeExamples/java-examples-dashboard/master/images/downloadZip-Button-Large.png" />
</a>
</p>
## Word API Features
### Rendering and Printing
- Layout document into pages with high fidelity (exactly like Microsoft Word® would do that) to all the formats below.
- Render individual pages or complete documents to `PDF`, `XPS`, or `SWF`.
- Render document pages to raster images (Multipage `TIFF`, `PNG`, `JPEG`, `BMP`).
- Render pages to a Java Graphics object to a specific size.
- Print document pages using the Java printing infrastructure.
- Update TOC, page numbers, and other fields before rendering or printing.
- 3D Effects Rendering through the `OpenGL`.
### Document Content Features
- Access, create, and modify various document elements.
- Access and modify all document elements using `XmlDocument` -like classes and methods.
- Copy and move document elements between documents.
- Join and split documents.
- Specify document protection, open protected, and encrypted documents.
- Find and replace text, enumerate over document content.
- Preserve or extract OLE objects and ActiveX controls from the document.
- Preserve or remove VBA macros from the document. Preserve VBA macros digital signature.
### Reporting Features
- Support of C# syntax and LINQ extension methods directly in templates (even for `ADO.NET` data sources).
- Support of repeatable and conditional document blocks (loops and conditions) for tables, lists, and common content.
- Support of dynamically generated charts and images.
- Support of insertion of outer documents and `HTML` blocks into a document.
- Support of multiple data sources (including of different types) for the generation of a single document.
- Built-in support of data relations (master-detail).
- Comprehensive support of various data manipulations such as grouping, sorting, filtering, and others directly in templates.
For a more comprehensive list of features, please visit [Feature Overview](https://docs.aspose.com/words/java/feature-overview/).
## Read & Write Document Formats
**Microsoft Word:** DOC, DOCX, RTF, DOT, DOTX, DOTM, DOCM FlatOPC, FlatOpcMacroEnabled, FlatOpcTemplate, FlatOpcTemplateMacroEnabled\
**OpenOffice:** ODT, OTT\
**WordprocessingML:** WordML\
**Web:** HTML, MHTML\
**Fixed Layout:** PDF\
**Text:** TXT
**Other:** MD
## Save Word Files As
**Fixed Layout:** XPS, OpenXPS, PostScript (PS)\
**Images:** TIFF, JPEG, PNG, BMP, SVG, EMF, GIF\
**Web:** HtmlFixed\
**Others:** PCL, EPUB, XamlFixed, XamlFlow, XamlFlowPack
## Read File Formats
**MS Office:** DocPreWord60
**eBook:** MOBI
## Supported Environments
- **Microsoft Windows:** Windows Desktop & Server (x86, x64)
- **macOS:** Mac OS X
- **Linux:** Ubuntu, OpenSUSE, CentOS, and others
- **Java Versions:** `J2SE 7.0 (1.7)`, `J2SE 8.0 (1.8)` or above.
## Get Started with Aspose.Words for Java
Aspose hosts all Java APIs at the [Aspose Repository](https://repository.aspose.com/webapp/#/artifacts/browse/tree/General/repo/com/aspose/aspose-words). You can easily use Aspose.Words for Java API directly in your Maven projects with simple configurations. For the detailed instructions please visit [Installing Aspose.Words for Java from Maven Repository](https://docs.aspose.com/words/java/installation/) documentation page.
## Printing Multiple Pages on One Sheet using Java
```java
// Open the document.
Document doc = new Document(dataDir + "TestFile.doc");
// Create a print job to print our document with.
PrinterJob pj = PrinterJob.getPrinterJob();
// Initialize an attribute set with the number of pages in the document.
PrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet();
attributes.add(new PageRanges(1, doc.getPageCount()));
// Pass the printer settings along with the other parameters to the print document.
MultipagePrintDocument awPrintDoc = new MultipagePrintDocument(doc, 4, true, attributes);
// Pass the document to be printed using the print job.
pj.setPrintable(awPrintDoc);
pj.print();
```
[Product Page](https://products.aspose.com/words/java) | [Docs](https://docs.aspose.com/words/java/) | [Demos](https://products.aspose.app/words/family) | [API Reference](https://apireference.aspose.com/words/java) | [Examples](https://github.com/aspose-words/Aspose.Words-for-Java/tree/master/Examples) | [Blog](https://blog.aspose.com/category/words/) | [Search](https://search.aspose.com/) | [Free Support](https://forum.aspose.com/c/words) | [Temporary License](https://purchase.aspose.com/temporary-license)
| 0 |
apache/geode-examples | Apache Geode Examples | geode | <!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
[<img src="https://geode.apache.org/img/Apache_Geode_logo.png" align="center"/>](http://geode.apache.org)
[](https://travis-ci.org.apache.geode_examples) [](https://www.apache.org/licenses/LICENSE-2.0)
# Apache Geode examples
This is the home of Apache Geode examples that are bundled with the project.
Contributions<sup>[2]</sup> and corrections are welcome. Please talk to us
about your suggestions at [dev@geode.apache.org](mailto:dev@geode.apache.org)
or submit a [pull request](https://github.com/apache/geode/pull/new/develop).
# Apache Geode Version
Geode client code must link against the _same or older_ version of Geode as the Geode server it will connect to.
Add `-PgeodeRepositoryUrl= -PgeodeVersion=1.12.0` to your `./gradlew` command to specify which Geode client libraries to link, otherwise the default may be too new.
If the latest examples don't compile with your preferred version of Geode, use `git tag` to list the available versions, then check out a suitable tag e.g. `git checkout rel/v1.12.0`.
## Running an example
The gradle build will automatically download and install a Geode release in the
`build` directory. You can run an example with the following gradle targets:
* `build` - compiles the example and runs unit tests
* `start` - initializes the Geode cluster
* `run` - runs the example Application
* `stop` - shuts down the cluster
* `runAll` - invokes start, run, stop
The commands you need to invoke will be given in the `README.md` file. Sample
usage:
$ ./gradlew :replicated:start
$ ./gradlew :replicated:run
$ ./gradlew :replicated:stop
$ ./gradlew runAll
$ ./gradlew runAll -PgeodeRepositoryUrl= -PgeodeVersion=1.12.0
## Catalog of examples
The following sections call out ready-made examples or new examples that could
be built. You may want to start your journey with the [Apache Geode in 15
minutes or
Less](https://geode.apache.org/docs/guide/13/getting_started/15_minute_quickstart_gfsh.html)
tutorial.
### Basics
* [Replicated Region](replicated/README.md)
* [Partitioned Region](partitioned/README.md)
* [Put Multiple Values at Once](putall/README.md)
* [Functions](functions/README.md)
* [Persistence](persistence/README.md)
* [OQL (Querying)](queries/README.md)
### Intermediate
* [Serialization](serialization/README.md)
* [Lucene Indexing](lucene/README.md)
* [OQL Indexing](indexes/README.md)
* [Cache Loader](loader/README.md)
* [Cache Writer](writer/README.md)
* [Cache Listeners](listener/README.md)
* [Async Event Queues & Async Event Listeners](async/README.md)
* [Continuous Querying](cq/README.md)
* [Transaction](transaction/README.md)
* [Eviction](eviction/README.md)
* [Expiration](expiration/README.md)
* [Overflow](overflow/README.md)
* [Security & SSL](clientSecurity/README.md)
* [Colocation](colocation/README.md)
* Off-heap
* [Rest](rest/README.md)
### Advanced
* [Lucene Spatial Indexing](luceneSpatial/README.md)
* [WAN Gateway](wan/README.md)
* [Durable Messaging for Subscriptions](durableMessaging/README.md)
* [Micrometer Metrics](micrometerMetrics/README.md)
* Delta propagation
* Network partition detection
* D-lock
* [Compression](compression/README.md)
* Resource manager
* PDX Advanced
### Use cases, integrations and external examples
This section has self-contained little projects that illustrate a use case or
an integration with other projects.
* SpringBoot Application
* HTTP Session replication
* Memcached
* Spark Connector
## Adding a new example
Follow this approach to add a new example:
* Create a subdirectory with a descriptive name like `cacheWriter`
* Create a `README.md` file in the example subproject to walk the user through the tutorial
* Create a Java class with a main method in the `org.apache.geode_examples.$name.Example` class
* Create a cluster initialization script in `scripts/start.gfsh`
* Create a cluster shutdown script in `scripts/stop.gfsh`
* Modify the top-level `settings.gradle` file to include subproject
* Modify this `README.md` file to include the new example in the catalog of examples
The scripts should contain `gfsh` commands for starting locators, servers, and
creating regions--everything that the example program will need to use. Where
appropriate you should also add unit tests. To customize the build you can add
a `build.gradle` file.
Verify that the examples build by executing `./gradlew runAll` from the root directory.
Note that the build may fail if you do not add ASF license headers or use the
correct formatting. You can fix formatting with `./gradlew spotlessApply`.
## References
- [1] [https://cwiki.apache.org/confluence/display/GEODE/Criteria+for+Code+Submissions](https://cwiki.apache.org/confluence/display/GEODE/Criteria+for+Code+Submissions)
- [2] [https://cwiki.apache.org/confluence/display/GEODE/How+to+Contribute](https://cwiki.apache.org/confluence/display/GEODE/How+to+Contribute)
- [3] [https://www.apache.org/licenses/#clas](http://www.apache.org/licenses/#clas)
## Export Control
This distribution includes cryptographic software.
The country in which you currently reside may have restrictions
on the import, possession, use, and/or re-export to another country,
of encryption software. BEFORE using any encryption software,
please check your country's laws, regulations and policies
concerning the import, possession, or use, and re-export of
encryption software, to see if this is permitted.
See <https://www.wassenaar.org/> for more information.
The U.S. Government Department of Commerce, Bureau of Industry and Security (BIS),
has classified this software as Export Commodity Control Number (ECCN) 5D002.C.1,
which includes information security software using or performing
cryptographic functions with asymmetric algorithms.
The form and manner of this Apache Software Foundation distribution makes
it eligible for export under the License Exception
ENC Technology Software Unrestricted (TSU) exception
(see the BIS Export Administration Regulations, Section 740.13)
for both object code and source code.
The following provides more details on the included cryptographic software:
* Apache Geode is designed to be used with
[Java Secure Socket Extension](https://docs.oracle.com/javase/8/docs/technotes/guides/security/jsse/JSSERefGuide.html) (JSSE) and
[Java Cryptography Extension](https://docs.oracle.com/javase/8/docs/technotes/guides/security/crypto/CryptoSpec.html) (JCE).
The [JCE Unlimited Strength Jurisdiction Policy](https://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html)
may need to be installed separately to use keystore passwords with 7 or more characters.
* Apache Geode links to and uses [OpenSSL](https://www.openssl.org/) ciphers.
| 0 |
ScottOaks/JavaPerformanceTuning | Examples for O'Reilly & Associates Java Performance Tuning: The Definitive Guide | null | null | 0 |
sryza/spark-ts-examples | Spark TS Examples | null | # spark-ts-examples
Description
-----------
Examples showing how to use the `spark-ts` time series library for Apache Spark.
Minimum Requirements
--------------------
* Java 1.8
* Maven 3.0
* Apache Spark 1.6.0
Using this Repo
---------------
### Building
We use [Maven](https://maven.apache.org/) for building Java / Scala. To compile and build
the example jar, navigate to the `jvm` directory and run:
mvn package
### Running
To submit one of the Java or Scala examples to a local Spark cluster, run the following command
from the `jvm` directory:
spark-submit --class com.cloudera.tsexamples.Stocks target/spark-ts-examples-0.0.1-SNAPSHOT-jar-with-dependencies.jar
You can substitute any of the Scala or Java example classes as the value for the `--class`
parameter.
To submit a Python example, run the following command from the `python` directory:
spark-submit --driver-class-path PATH/TO/sparkts-0.3.0-jar-with-dependencies.jar Stocks.py
The `--driver-class-path` parameter value must point to the Spark-TS JAR file, which can be
downloaded from the spark-timeseries [Github repo](https://github.com/sryza/spark-timeseries).
| 0 |
Chainfire/libsuperuser | Example code for How-To SU"" | null | # libsuperuser
[![ci][1]][2] [](https://jitpack.io/#eu.chainfire/libsuperuser)
Example code for "How-To SU"
For some outdated background details, see:
[http://su.chainfire.eu/](http://su.chainfire.eu/)
Even though its outdated with regards to usage of this library,
if you're unfamiliar with writing code for root usage, it is not
a bad idea to read it.
## License
Copyright © 2012-2019 Jorrit *Chainfire* Jongma
This code is released under the [Apache License version 2.0](https://www.apache.org/licenses/LICENSE-2.0).
## Deprecated
This library is not under active development right now, as I've mostly
moved away from the Android world. While I believe it still works great,
if it breaks due to changes on new Android versions or root solutions,
fixes may be slow to appear.
If you're writing a new app, you might consider using
[TopJohnWu's libsu](https://github.com/topjohnwu/libsu) instead. Barring
some edge-cases (that I personally seem to be the biggest user of) the
capabilities should be similar, but it's likely to be better maintained.
## v1.1.0 update
It is now 2019, 7 years since the initial release of
*libsuperuser*, and I have *finally* gotten around to releasing v1.1.0,
and writing an updated how-to. See, I don't need reminding every 6
months.
This update brings support for commands returning an `InputStream` for
STDOUT, as well as adding per-line and buffered STDERR support to
various methods.
As `Shell.Interactive` can be a bit tricky to use and understand
callback and threading wise, especially when used from a background
thread, the `Shell.Threaded` subclass has been added. This class
maintains its own dedicated background thread, upon which all the
callbacks are executed.
`Shell.Interactive` (and `Shell.Threaded`) have gained synchronous
methods, that may be easier to handle than the asynchronous ones, when
used from a background thread. Obviously one cannot use them from the
main UI thread, as this would block the UI.
Last but not least, `Shell.Pool` has been added, which maintains a
pool of `Shell.Threaded` instances for your app to use; created, cached,
and closed on-demand. For new users, `Shell.Pool` is the place to start.
If you're looking at the source of the library, `Shell.java` has
become way too large and would look better broken up. This is
intentionally not done to maintain better backward compatibility
with old code, of which there is quite a bit.
## Upgrading from v1.0.0 to v1.1.0
No functionality has been removed, but some of the method signatures
have subtly changed, and a lot of methods have been deprecated
(though they will not be removed). The compiler will certainly tell
you about these. Some interface have been renamed, and some methods
were added to existing interfaces. All `Exception` based classes have
moved to inner classes of `Shell`.
`Shell.run(...)`, and all `Shell.SH.xxx` and `Shell.SU.xxx` methods
automatically redirect to their `Shell.Pool.xxx` counterparts. This
is a free speed-up for code using these methods. The redirection
can be turned off by calling `Shell.setRedirectDeprecated(false)`
from something like `Application::onCreate()`.
While most code should run the same without issue, you should
definitely double check, especially for complicated scripts or
commands that set specific environment variables.
`Shell.Interactive` should work exactly as it always has, but
since some threading-related code has changed internally, it is
always wise to check if everything still works as expected.
There is no need to migrate existing `Shell.Interactive` code to
`Shell.Threaded`, unless you want to use the functionality
provided by `Shell.Pool`. Be sure to read about the usage difference
between them below.
Last but not least, `minSdkVersion` was updated from 4 to 5, so
we're losing compatibility with Android 1.6 Donut users, sorry.
## Example project
The example project is very old, and does not follow current best
practises. While `PooledActivity` has been added demonstrating
some calls using `Shell.Threaded` and `Shell.Pool`, they aren't
particularly good. The old code demonstrating both legacy and
interactive modes remains present. Use the mode button at the bottom
to switch between activities.
## Basics
This page is not intended as a full reference, just to get you
started off. There are many methods and classes in the library
not explained here. For more advanced usages, consult the source
code - over 1/3rd of the lines belong to comments.
Some of the below may seem out-of-order, you might want to read
this entire section twice.
#### Blocking, threads, and ShellOnMainThreadException
Running subprocesses is expensive and timings cannot be predicted.
For something like running "su" even more so, as it can launch
a dialog waiting for user interaction. Many methods in this library
may be *blocking* (taking unpredictable time to return). When you
attempt to call any of these methods from the main UI thread, the
library will throw a `Shell.ShellOnMainThreadException` at you, if
your app is compiled in debug mode. (Note that this behavior can
be disabled through the `Debug.setSanityChecksEnabled(false)` call).
Methods that may throw this exception include any of the `run(...)`,
`waitFor...()`, and `close...()` methods, with the exception of
`closeWhenIdle()`.
The `Shell.Builder`, `Shell.Interactive` and `Shell.Threaded` classes
provide `addCommand(...)` methods, which run asynchronously and provide
completion callbacks. `addCommand(...)` can safely be called from
the main UI thread.
`Shell.Interactive` (and its `Shell.Threaded` subclass) is a class
wrapping a running instance of a shell (such as "sh" or "su"),
providing methods to run commands in that shell and return the output
of each individual command and its exit code. As opening a shell
itself can be very expensive (especially so with "su"), it is
preferred to use few interactive shells to run many commands rather
than executing a single shell for each individual command.
`Shell.Interactive` (and its `Shell.Threaded` subclass) uses two
background threads to continuously gobble the input from STDOUT and
STDERR. This is an (unfortunate) requirement to prevent the underlying
shell from possibly deadlocking if it produces large amounts of output.
When an instance of `Shell.Interactive` is created, it determines if
the calling thread has an Android `Looper` attached, if it does, it
creates an Android `Handler`, to which all callbacks (such as the
interfaces passed to `addCommand(...)`) are passed. The callbacks
are then executed on the original calling thread. If a `Looper` is
not available, callbacks are usually executed on the gobbler threads
(which increases the risk of deadlocks, and should be avoided), but
may also be executed on the calling thread (which can cause deadlocks
in your own threading code).
(Didn't make sense? Don't worry about it, and just follow the
advice and examples below)
#### `Shell.Interactive` vs `Shell.Threaded`
`Shell.Interactive`'s threading/callback model *can* be fine when it's
used from the main UI thread. As the main UI thread most certainly has
a `Looper`, there is no problem creating a `Handler`, and the callbacks
are run directly on the main UI thread. While this does allow you to
directly manipulate UI elements from the callbacks, it also causes
jank if your callbacks take too long to execute.
However, when `Shell.Interactive` is used from a background thread,
unless you manually create and manage a special secondary thread for
it (a `HandlerThread`), callbacks run on the gobbler threads, which is
potentially bad.
The `Shell.Threaded` subclass specifically creates and manages this
secondary `HandlerThread` for you, and guarantees all callbacks are
executed on that thread. This prevents most deadlock situations from
happening, and is consistent in its behavior across the board.
The drawback there is that you cannot directly manipulate UI elements
from the callbacks passed to `addCommand(...)` (or any other methods),
but that is probably not what you end up wanting to do in any
real-world app anyway. When the need arises, you can use something
like `Activity::runOnUiThread(...)` to call code that adjusts the UI.
Additionally, `Shell.Threaded` is easier to setup and supports pooling
via `Shell.Pool` (explained further below). The choice which to use
should be easy at this point, unless you have some very specific needs.
If you are porting from `Shell.Interactive` to `Shell.Threaded`, please
note that the behavior of the `close()` method is different between
the two. In `Shell.Interactive` it redirects to `closeImmediately()`,
which waits for all commands to complete and then closes the shell.
In `Shell.Threaded` it returns the shell to the pool if it is
part of one, and otherwise redirects to `closeWhenIdle()`, which
schedules the actual close when all commands have completed, but
returns immediately. This discrepancy is unfortunate but required
to maintain both good backwards compatibility and support pooling
with try-with-resources.
#### Common methods
Examples follow further below, which make use of pooling. But before
pooling can be explained, the common methods you will use with
different classes need a quick walk-through.
#### Common methods: `addCommand(...)`
The `Shell.Builder` (used to manually construct `Shell.Interactive`
and `Shell.Threaded` instances), `Shell.Interactive` and
`Shell.Threaded` classes provide `addCommand(...)` methods. These
run asynchronously and are safe to call from the main UI thread: they
return before the commands complete, and an optionally provided
callback is executed when the command does complete:
- `addCommand(Object commands)`
- `addCommand(Object commands, int code, OnResult onResultListener)`
`commands` accepts a `String`, a `List<String>`, or a `String[]`.
`onResultListener` is one of:
- `OnCommandResultListener2`, which buffers STDOUT and STDERR and
returns them to the callback all in one go
- `OnCommandLineListener`, which is unbuffered and is called once
for each line read from STDOUT or STDERR
- `OnCommandInputStreamListener`, which is called with an
`InputStream` you can use to read raw data from the shell. You
should continue reading the `InputStream` until *-1* is returned
(*not 0* as is sometimes done), or further commands on this shell
will not execute. You can call `InputStream::close()` to do this
for you. Additionally, if the shell is closed during reading, then
(and only then) an `IOException` will be thrown.
All of these provide an `onCommandResult` method that is called
with the `code` you passed in, and the exit code of the (last) of the
commands passed in. Note that the exit code will be < 0 if an error
occurs, such as the shell being closed.
The `addCommand(...)` calls will *not* be further explained in this
document, consult the example project (`InteractiveActivity.java`)
and the library source for further details.
#### Common methods: `run(...)`
The `Shell.Interactive`, `Shell.Threaded`, and `Shell.PoolWrapper`
classes provide `run(...)` methods. These run synchronously and are
*not* safe to call from the main UI thread: they return when the
command is completed:
- `int run(Object commands)`
- `int run(Object commands, List<String> STDOUT, List<String> STDERR, boolean clear)`
- `int run(Object commands, OnSyncCommandLineListener onSyncCommandLineListener)`
- `int run(Object commands, OnSyncCommandInputStreamListener onSyncCommandInputStreamListener)`
As before, `commands` accepts a `String`, a `List<String>`, or a `String[]`.
It should be obvious that these are simply the synchronous counterparts
of the asynchronous `addCommand(...)` methods.
Instead of calling a callback interface with the exit code, it is
returned directly, and instead of returning a negative exit code on
error, `Shell.ShellDiedException` is thrown.
#### Pooling
The `Shell.Pool` class provides shell pooling. It will create new
shell instances on-demand, and keep a set number of them around for
reuse later (4 by default for "su" instances, 1 for non-"su" instances).
`Shell.Pool.SH` and `Shell.Pool.SU` are pre-created instances of
`Shell.PoolWrapper` for "sh" and "su", providing `get()` and the
earlier mentions `run(...)` methods for the pool.
The `get()` method can be used to retrieve a `Shell.Threaded` instance
from the pool, which you should later return to the pool by calling
it's `close()` method.
The `run(...)` methods, instead of operating on a specific
`Shell.Threaded` instance you manage, retrieve an instance from the
pool, proxies the call to that instance's `run(...)` method, and
then immediately returns the instance to the pool.
Sound complex? Maybe, but it all comes together so you can sprinkle
`Shell.Pool.SU.run(...)` calls throughout as many threads as you wish
(barring of course the main UI thread), running simultaneously or not,
with instances being created, reused, and closed automatically. All of
this without you ever having to worry about managing the instances,
and only having to catch a single `Shell.ShellDiedException`.
#### Examples
It is assumed all the code following is run from a background thread,
such as `Thread`, `AsyncTask`, or `(Job)IntentService`.
Running some basic commands:
```
try {
List<String> STDOUT = new ArrayList<String>();
List<String> STDERR = new ArrayList<String>();
int exitCode;
exitCode = Shell.Pool.SU.run("echo nobody will ever see this");
// we have only an exit code
exitCode = Shell.Pool.SU.run("ls -l /", STDOUT, STDERR, true);
// exit code, and STDOUT/STDERR output
exitCode = Shell.Pool.SU.run("cat /init.rc", new Shell.OnSyncCommandInputStreamListener() {
@Override
public void onInputStream(InputStream inputStream) {
try {
byte[] buf = new byte[16384];
int r;
while ((r = inputStream.read(buf)) >= 0) {
// do something with buf
// if we decide to abort before r == -1, call inputStream.close()
}
} catch (IOException e) {
// shell died during read
}
}
@Override
public void onSTDERR(String line) {
// hey, some output on STDERR!
}
});
Shell.Pool.SU.run("logcat -d", new Shell.OnSyncCommandLineListener() {
@Override
public void onSTDOUT(String line) {
// hey, some output on STDOUT!
}
@Override
public void onSTDERR(String line) {
// hey, some output on STDERR!
}
});
} catch (Shell.ShellDiedException e) {
// su isn't present, access was denied, or the shell terminated while 'run'ing
}
```
When running multiple commands in quick succession, it is slightly
cheaper to `get()` an instance and `close()` it when done, and using
the returned instance. But keep in mind if there is a longer period
between your calls, and another thread wants to call su, the shell you
have not `close()`'d yet cannot be reused by that thread:
```
try {
// get an instance from the pool
Shell.Threaded shell = Shell.Pool.SU.get();
try {
// this is very useful
for (int i = 0; i < 100; i++) {
shell.run("echo nobody will ever see this");
}
} finally {
// return the instance to the pool
shell.close();
}
} catch (Shell.ShellDiedException e) {
// su isn't present, access was denied, or the shell terminated while 'run'ing
}
```
If you're targeting API >= 19 and Java 1.8, you can use
try-with-resources with `Shell.Threaded::ac()`, which casts the
instance to a `Shell.ThreadedAutoCloseable`:
```
try {
// get an instance from the pool, automatically returning it at the end of the try block
try (Shell.ThreadedAutoCloseable shell = Shell.Pool.SU.get().ac()) {
// this is very useful
for (int i = 0; i < 100; i++) {
shell.run("echo nobody will ever see this");
}
}
} catch (Shell.ShellDiedException e) {
// su isn't present, access was denied, or the shell terminated while 'run'ing
}
```
## libRootJava
For more advanced usages of root, such as running Java/Kotlin code as
root directly, please see my [libRootJava](https://github.com/Chainfire/librootjava)
library.
## Annotations
Nullity and thread annotations have recently been added.
Please note that *all* methods that *may* be problematic on the UI
thread have been marked as `@WorkerThread`. Some of these methods
can be called from the UI thread without issue in specific conditions.
If so, those conditions should be noted in the method's javadoc.
## Gradle
Root `build.gradle`:
```
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
```
Module `build.gradle`:
```
dependencies {
implementation 'eu.chainfire:libsuperuser:1.1.1'
}
```
[1]: https://github.com/Chainfire/libsuperuser/workflows/ci/badge.svg
[2]: https://github.com/Chainfire/libsuperuser/actions
| 1 |
royrusso/akka-java-examples | Example implementation of various akka patterns in Java | null | Akka examples in Java
==============
A few examples using Akka with Java. These examples have basic structures in common:
* Coded in Java.
* Clustered Akka setup.
* Logback / SL4J Logger. Log file is under the root path: ``/logs``
* Akka configuration has most logging options turned on. (chatty)
All examples are runnable from within your IDE, by executing the ``Main`` method in the corresponding ``org.royrusso.app.System`` class.
Simple Akka Example
------------------
``/simple`` :: The simplest of Akka examples. Creates an Actor that processes a command.
Akka Parent-Child Actors
------------------
``/parent-child`` :: This example illustrates how you can configure an Akka cluster for hierarchical Actor relationships.
This cluster contains Parent Actors that, given a Command, send an Event to a Child Actor for processing.
Akka Persistence with EventSourcing
------------------
``/eventsourcing-persistence`` :: Usage of the new Akka Persistence module with Event Sourcing. An Akka Processor is responsible for processing non-persistent Commands
that generate Events. The Events are persisted, and then allowed to modify the state of the processor. Additionally, the events are broadcast over the eventstream.
During recovery, the system then loads the persisted Events and replays them to the processor.
On restart, the system will load its last known state from the latest Snapshot (``snapshot`` dir), and replay all Journaled (``journal`` dir) Events after that point.
Notes:
* LevelDB is used for persistence in this example.
* ``/snapshots`` contains the snapshot of the processor states.
* ``/journal`` contains the running journal of events.
Akka Persistent Channels
-----------------------
``persistent-channel`` :: Illustrates how to send/receive payloads between actors listening on a channel. Messages are persisted until there is a valid confirmation
of it being received by the destination Actor, and then deleted. This example also illustrates how the destination Actor may respond with an ack.
Akka Event-Bus
------------------
``/event-bus`` :: Here we show how the Akka EventStream can be used by Actors that are subscribed to listen for certain event types that are emitted by another actor.
| 1 |
geowarin/hibernate-examples | Hibernate examples from my blog http://geowarin.wordpress.com | null | Hibernate examples
==================
Hibernate examples from my blog http://geowarin.wordpress.com/tag/hibernate | 0 |
jsflive/jsf22-examples | JSFlive JSF 2.2 Examples | null | JSFlive JSF 2.2 Examples
========================
This is a collection of examples for the [JSFlive JSF 2.2 series](http://jsflive.wordpress.com/category/jsf-2-2/ "JSFlive series on new features of JSF 2.2").
Included examples:
* CollectionDataModel ([JSFlive post on JSF 2.2 CollectionDataModel](http://jsflive.wordpress.com/2013/03/30/jsf22-collectiondatamodel/ "JSFlive JSF 2.2: CollectionDataModel"))
* Composite components in taglibs ([JSFlive post on JSF 2.2 Composite components in taglibs](http://jsflive.wordpress.com/2013/04/06/jsf22-cc-taglib/ "JSFlive JSF 2.2: Composite components in taglibs"))
* Configurable resource directory ([JSFlive post on JSF 2.2 Configurable resource directory](http://jsflive.wordpress.com/2013/04/01/jsf22-config-resource-dir/ "JSFlive JSF 2.2: Configurable resource directory"))
* Empty composite component attributes ([JSFlive post on JSF 2.2 Empty composite component attributes](http://jsflive.wordpress.com/2013/04/08/jsf22-empty-cc-attrs/ "JSFlive JSF 2.2: Empty composite component attributes"))
* File upload with h:inputFile ([JSFlive post on JSF 2.2 File upload with h:inputFile](http://jsflive.wordpress.com/2013/04/23/jsf22-file-upload/ "JSFlive JSF 2.2: File upload with h:inputFile"))
* HTML5 friendly markup ([JSFlive post on JSF 2.2 HTML5 friendly markup](http://jsflive.wordpress.com/2013/08/08/jsf22-html5/ "JSFlive JSF 2.2: HTML5 friendly markup"))
* Reset input fields ([JSFlive post on JSF 2.2 Reset input fields](http://jsflive.wordpress.com/2013/06/20/jsf-22-reset-values/ "JSFlive JSF 2.2: Reset input fields"))
* View actions ([JSFlive post on JSF 2.2 view actions](http://jsflive.wordpress.com/2013/03/22/jsf22-view-actions/ "JSFlive JSF 2.2: View actions"))
* View scope for CDI ([JSFlive post on JSF 2.2 View scope for CDI](http://jsflive.wordpress.com/2013/07/17/jsf22-cdi-view-scope/ "JSFlive JSF 2.2: View scope for CDI"))
| 0 |
tfnico/guava-examples | Examples of Google Guava usage | null | null | 0 |
PacktPublishing/Mastering-Distributed-Tracing | Mastering Distributed Tracing" by Yuri Shkuro | published by Packt" |
# Mastering Distributed Tracing
by [Yuri Shkuro](https://www.shkuro.com). Illustrations by [Lev Polyakov](https://polyakovproductions.com/).
Published by: Packt Publishing (2019)
This is the code repository for the book _[Mastering Distributed Tracing](https://www.packtpub.com/networking-and-servers/mastering-distributed-tracing?utm_source=github&utm_medium=repository&utm_campaign=9781788628464)_. It contains all the supporting project files necessary to work through the book from start to finish.
## About the book
_Mastering Distributed Tracing_ provides comprehensive coverage of the tracing field. Solve problems through code instrumentation with open standards, and learn how to profile complex systems. The book will also prepare you to operate and enhance your own tracing infrastructure.
## Navigation
* [Chapter 4: Instrumentation Basics with OpenTracing](./Chapter04)
* [Chapter 5: Instrumentation of Asynchronous Applications](./Chapter05)
* [Chapter 7: Tracing with Service Mesh](./Chapter07)
* [Chapter 11: Integration with Metrics and Logs](./Chapter11)
* [Chapter 12: Gathering Insights Through Data Mining](./Chapter12)
### Download a free PDF
<i>If you have already purchased a print or Kindle version of this book, you can get a DRM-free PDF version at no cost.<br>Simply click on the link to claim your free PDF.</i>
<p align="center"> <a href="https://packt.link/free-ebook/9781788628464">https://packt.link/free-ebook/9781788628464 </a> </p> | 0 |
quarkus-for-spring-developers/examples | Example code for the Quarkus for Spring Developers eBook | event-driven examples java kubernetes kubernetes-native quarkus spring spring-boot | Example code for the [Quarkus for Spring Developers](https://red.ht/quarkus-spring-devs) eBook. Code is organized by chapter. Each project is self-contained, meaning there is no parent/child structure amongst projects.
# Versions
Whenever possible, versions of Quarkus and Spring used in these examples are kept up-to-date as much as possible. The frameworks may have evolved since the book's writing and perhaps there is a better/different way to do something than what is shown in the book's code excerpts. The code in this repository will be kept in sync with what is shown in the book so that those examples may be replicated successfully. As new editions of the book are published, examples may be changed to reflect new patterns.
Here is a summary of some of the new features which may affect the examples in the book. The examples in this repo won't be updated to take advantage of these capabilities until a new revision of the book is released.
## Quarkus
- [RESTEasy Reactive - to block or not to block](https://quarkus.io/blog/resteasy-reactive-smart-dispatch/)
- New features in RESTEasy Reactive allow Quarkus to automatically detect whether a method is blocking or non blocking
- Starting with Quarkus 2.2, this means that the `@Blocking` annotation used in many of the Quarkus examples is no longer needed. Quarkus will "figure it out" on its own.
- Panache Reactive with Hibernate Reactive
- The Quarkus reactive examples in chapter 4 using Panache Reactive currently use a custom built class for implementing transaction rollback within tests.
- Quarkus now includes an `@TestReactiveTransaction` annotation that can automatically rollback transactions within tests, similar to how the `@TestTransaction` annotation works in the Hibernate ORM examples in chapter 4.
- `quarkus.hibernate-orm.database.generation` will default to `drop-and-create` when Dev Services is in use.
- `@NativeImageTest` has been deprecated in favor of `@QuarkusIntegrationTest`
- The `maven-failsafe-plugin` has been moved out of the `native` Maven profile and into the main profile.
## Spring
- The implementation of [`chapter-5`s Spring Kafka test example](chapter-5/chapter-5-spring-kafka-streams/src/test/java/org/acme/DockerComposeBase.java) had to be modified to use [`KafkaContainer`](https://www.testcontainers.org/modules/kafka/) instead of [`DockerComposeContainer`](https://www.testcontainers.org/modules/docker_compose/) due to docker compose "flakiness" that was happening within the GitHub Actions CI/CD process. The Spring Kafka tests were continually failing within the CI/CD process.
- Spring Boot 3/Spring 6/Spring Cloud 2022.0 has shipped but would have an impact on the examples in the book, plus would require Java 17, therefore the examples will not yet be updated to those versions.
# Book Chapter Text
The table below describes the versions of the example snippets used in the book's chapter text:
| Framework | Version |
| --------- | ------- |
| Quarkus | `2.1.4.Final` |
| Spring Boot | `2.5.4` |
# Examples Repo
The table below describes the versions of the examples in this repo:
| Framework | Version |
| --------- |---------------|
| Quarkus | `2.16.12.Final` |
| Spring Boot | `2.7.16` |
# Chapter List
- Chapter 1 - Introducing Quarkus (No example code)
- [Chapter 2 - Getting Started with Quarkus](chapter-2/README.md)
- [Chapter 3 - Building RESTful Applications](chapter-3/)
- [Chapter 4 - Persistence](chapter-4/)
- [Chapter 5 - Event Driven Services](chapter-5/)
- [Chapter 6 - Building Applications for the Cloud](chapter-6/)
| 1 |
udacity/nd035-c1-spring-boot-basics-examples | null | null | null | 0 |
nurkiewicz/rxjava-book-examples | Source code of all examples from Reactive Programming with RxJava book | null | # Source code of examples from _Reactive Programming with RxJava_
Book is available on [O'Reilly](http://shop.oreilly.com/product/0636920042228.do) and [Amazon](http://amzn.to/2gJ6Vhx).
If you find any example incomplete or broken, please [submit a PR](https://github.com/nurkiewicz/rxjava-book-examples/pulls) or [create an issue](https://github.com/nurkiewicz/rxjava-book-examples/issues/new).
* [Chapter 1](https://github.com/nurkiewicz/rxjava-book-examples/tree/master/src/test/java/com/oreilly/rxjava/ch1)
* [Chapter 2](https://github.com/nurkiewicz/rxjava-book-examples/tree/master/src/test/java/com/oreilly/rxjava/ch2)
* [Chapter 3](https://github.com/nurkiewicz/rxjava-book-examples/tree/master/src/test/java/com/oreilly/rxjava/ch3)
* [Chapter 4](https://github.com/nurkiewicz/rxjava-book-examples/tree/master/src/test/java/com/oreilly/rxjava/ch4)
* [Chapter 5](https://github.com/nurkiewicz/rxjava-book-examples/tree/master/src/test/java/com/oreilly/rxjava/ch5)
* [Chapter 6](https://github.com/nurkiewicz/rxjava-book-examples/tree/master/src/test/java/com/oreilly/rxjava/ch6)
* [Chapter 7](https://github.com/nurkiewicz/rxjava-book-examples/tree/master/src/test/java/com/oreilly/rxjava/ch7)
* [Chapter 8](https://github.com/nurkiewicz/rxjava-book-examples/tree/master/src/test/java/com/oreilly/rxjava/ch8)
* [Chapter 9](https://github.com/nurkiewicz/rxjava-book-examples/tree/master/src/test/java/com/oreilly/rxjava/ch9)
* [Appendix 1](https://github.com/nurkiewicz/rxjava-book-examples/tree/master/src/test/java/com/oreilly/rxjava/appendix1)
# Remarks
1. Some examples were slightly modified to support newer versions of dependent libraries
2. Java projects can't simply import Android `.aar` libraries. Therefore parts of [RxAndroid](https://github.com/ReactiveX/RxAndroid) and [RxBinding](https://github.com/JakeWharton/RxBinding) source code were copied directly.
| 0 |
bonigarcia/webdrivermanager-examples | JUnit tests with Selenium WebDriver and WebDriverManager | java junit junit5 selenium selenium-webdriver webdrivermanager | [](https://search.maven.org/#search%7Cga%7C1%7Cg%3Aio.github.bonigarcia%20a%3Awebdrivermanager)
[](https://github.com/bonigarcia/webdrivermanager-examples/actions)
[](https://www.oracle.com/java/technologies/downloads/)
[](https://www.apache.org/licenses/LICENSE-2.0)
[](#backers)
[](#sponsors)
[](https://stackoverflow.com/questions/tagged/webdrivermanager-java)
[](https://twitter.com/boni_gg)
# WebDriverManager Examples [![][Logo]][GitHub Repository]
This repository contains JUnit examples to automate the [Selenium WebDriver] driver management using [WebDriverManager]. These examples are open-source, released under the terms of [Apache 2.0 License].
## Usage
In order to use WebDriverManager from tests in a Maven project, you need to add the following dependency in your `pom.xml`:
```xml
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>${wdm.version}</version>
<scope>test</scope>
</dependency>
```
... or in a Gradle project:
```
dependencies {
testImplementation("io.github.bonigarcia:webdrivermanager:${wdm.version}")
}
```
Then you can let WebDriverManager to manage the drivers required by Selenium WebDriver (e.g., chromedriver, geckodriver). For example, as a JUnit test using Chrome browser:
```java
class ChromeTest {
WebDriver driver;
@BeforeAll
static void setupClass() {
WebDriverManager.chromedriver().setup();
}
@BeforeEach
void setupTest() {
driver = new ChromeDriver();
}
@AfterEach
void teardown() {
driver.quit();
}
@Test
void test() {
// Your test code here
}
}
```
... or using Firefox:
```java
class FirefoxTest {
WebDriver driver;
@BeforeAll
static void setupClass() {
WebDriverManager.firefoxdriver().setup();
}
@BeforeEach
void setupTest() {
driver = new FirefoxDriver();
}
@AfterEach
void teardown() {
driver.quit();
}
@Test
void test() {
// Your test code here
}
}
```
## Help
If you have questions on how to use WebDriverManager properly with a special configuration or suchlike, please consider asking a question on [Stack Overflow] and tag it with *webdrivermanager-java*.
## Support
WebDriverManager is part of [OpenCollective], an online funding platform for open and transparent communities. You can support the project by contributing as a backer (i.e., a personal [donation] or [recurring contribution]) or as a [sponsor] (i.e., a recurring contribution by a company).
### Backers
<a href="https://opencollective.com/webdrivermanager" target="_blank"><img src="https://opencollective.com/webdrivermanager/backers.svg?width=890"></a>
### Sponsors
<a href="https://opencollective.com/webdrivermanager/sponsor/0/website" target="_blank"><img src="https://opencollective.com/webdrivermanager/sponsor/0/avatar.svg"></a>
<a href="https://opencollective.com/webdrivermanager/sponsor/1/website" target="_blank"><img src="https://opencollective.com/webdrivermanager/sponsor/1/avatar.svg"></a>
<a href="https://opencollective.com/webdrivermanager/sponsor/2/website" target="_blank"><img src="https://opencollective.com/webdrivermanager/sponsor/2/avatar.svg"></a>
<a href="https://opencollective.com/webdrivermanager/sponsor/3/website" target="_blank"><img src="https://opencollective.com/webdrivermanager/sponsor/3/avatar.svg"></a>
<a href="https://opencollective.com/webdrivermanager/sponsor/4/website" target="_blank"><img src="https://opencollective.com/webdrivermanager/sponsor/4/avatar.svg"></a>
<a href="https://opencollective.com/webdrivermanager/sponsor/5/website" target="_blank"><img src="https://opencollective.com/webdrivermanager/sponsor/5/avatar.svg"></a>
<a href="https://opencollective.com/webdrivermanager/sponsor/6/website" target="_blank"><img src="https://opencollective.com/webdrivermanager/sponsor/6/avatar.svg"></a>
<a href="https://opencollective.com/webdrivermanager/sponsor/7/website" target="_blank"><img src="https://opencollective.com/webdrivermanager/sponsor/7/avatar.svg"></a>
<a href="https://opencollective.com/webdrivermanager/sponsor/8/website" target="_blank"><img src="https://opencollective.com/webdrivermanager/sponsor/8/avatar.svg"></a>
<a href="https://opencollective.com/webdrivermanager/sponsor/9/website" target="_blank"><img src="https://opencollective.com/webdrivermanager/sponsor/9/avatar.svg"></a>
## About
WebDriverManager (Copyright © 2015-2023) is a personal project of [Boni Garcia] licensed under [Apache 2.0 License].
[Apache 2.0 License]: https://www.apache.org/licenses/LICENSE-2.0
[Boni Garcia]: https://bonigarcia.github.io/
[Selenium WebDriver]: https://docs.seleniumhq.org/projects/webdriver/
[WebDriverManager]:https://github.com/bonigarcia/webdrivermanager/
[Logo]: https://bonigarcia.github.io/img/webdrivermanager.png
[GitHub Repository]: https://github.com/bonigarcia/webdrivermanager-examples
[Stack Overflow]: https://stackoverflow.com/questions/tagged/webdrivermanager-java
[OpenCollective]: https://opencollective.com/webdrivermanager
[donation]: https://opencollective.com/webdrivermanager/donate
[recurring contribution]: https://opencollective.com/webdrivermanager/contribute/backer-8132/checkout
[sponsor]: https://opencollective.com/webdrivermanager/contribute/sponsor-8133/checkout
| 0 |
roskenet/spring-javafx-examples | Example apps for springboot-javafx-support. See | examples fxml javafx spring springboot | # Examples how to use springboot-javafx-support
See: https://www.felixroske.de/page/programmierung/index.html
| 1 |
mfaisalkhatri/rest-assured-examples | Learn API testing using rest-assured framework. | api-automation apitesting automation-test hacktoberfest learning-by-doing rest-assured test-automation testing testing-framework tutorial | [](https://github.com/mfaisalkhatri/rest-assured-examples/actions/workflows/maven.yml)

[](https://opensource.org/licenses/Apache-2.0)
## Don't forget to give a :star: to make the project popular.
## :question: What is this Repository about?
This project is the outcome of my self-learning about the API Testing Automation framework - Rest-assured.
I heard a lot about Rest-Assured and how it made the QA's life easier by helping them to run all the tedious API tests
in an efficient way.
Hence, I started learning about the framework and have documented all my learnings in this repository with all
example code from writing basic tests to running end to end API automation tests.
## :briefcase: What does this repo contain?
- This repo contains example codes of API Tests using Rest-Assured.
- `Hamcrest Matchers` are used for assertions.
- [TestNG](https://testng.org) Listeners are used to capture the events in logs.
- `Log4j` is used to capture logs.
- [Lombok](https://projectlombok.org/) is used to generate Getter and Setters automatically for post body
requests.
- FAKE Rest APIs on [Reqres.in](https://reqres.in/) is used for testing.
- End to End scenarios have been added for
the [restful booker APIs](https://restful-booker.herokuapp.com/apidoc/index.html).
## :hammer_and_wrench: Talking more about the Scenarios Covered in this project:
You will get the answers to the following questions and its respective working code example with rest-assured
framework in this repository:
- How to write tests for `Get` requests?
- How to write tests for `POST` requests?
- How to write tests for `PUT` requests?
- How to write tests for `PATCH` requests?
- How to write tests for `DELETE` requests?
- How to handle the `authentication` requests?
- How to write tests for `SOAP API` requests?
- How to verify the Response Body?
- How to verify the Response Status Code?
- How to verify the Response headers?
- How to extract value from Response Body?
- How to perform assertions using `Hamcrest Matchers`?
- How to create `POJO` for passing values to request body?
- How to use `Lombok` to generate `Getters` and `Setters`?
- How to use `Lombok` for writing the builder pattern code?
- How to use Builder Pattern for test data generation using [Data Faker](https://github.com/datafaker-net/datafaker)?
- How to write end-to-end api tests?
- How to perform `JSON Schema Validation`?
## :writing_hand: Blog Links
- [What is API Testing?](https://mfaisalkhatri.github.io/2020/08/08/apitesting/)
- [End to End API testing using rest-assured](https://medium.com/@iamfaisalkhatri/end-to-end-api-testing-using-rest-assured-a58c4ea80255)
- [How to perform JSON Schema Validation using Rest-Assured?](https://medium.com/@iamfaisalkhatri/how-to-perform-json-schema-validation-using-rest-assured-64c3b6616a91)
- [API Testing using RestAssured and OkHttp](https://mfaisalkhatri.github.io/2020/05/29/restassuredokhttp/)
## :movie_camera: Tutorial Video
[](https://www.youtube.com/watch?v=xLKpdQE0oKY&t=1s)
[](https://www.youtube.com/live/AFQSolEeu74?si=8WROMbunjUuzqqQj&t=1)
## :question: Need Assistance?
- Discuss your queries by writing to me @ `mohammadfaisalkhatri@gmail.com`
OR ping me on any of the social media sites using the below link:
- [Linktree](https://linktr.ee/faisalkhatri)
## :computer: Paid Trainings
- Contact me for Paid trainings related to Test Automation and Software Testing,
mail me @ `mohammadfaisalkhatri@gmail.com` or ping me on [LinkedIn](https://www.linkedin.com/in/faisalkhatri/)
## :thought_balloon: Checkout the blogs related to Testing written by me on the following links:
- [Medium Blogs](https://medium.com/@iamfaisalkhatri)
- [LambdaTest Blogs](https://www.lambdatest.com/blog/author/mfaisalkhatri/)
- [My Website](https://mfaisalkhatri.github.io)
| 0 |
mattia-battiston/clean-architecture-example | Clean Architecture Example (Java): Example of what clean architecture would look like (in Java) | null | # clean-architecture-example
This is an example project to show what Clean Architecture would look like (in Java).
It was originally created to go together with [this presentation](http://www.slideshare.net/mattiabattiston/real-life-clean-architecture-61242830)
**Table of Contents**
* [Why Clean Architecture?](#why-clean-architecture)
* [Application Structure](#application-structure)
* [Testing Strategy](#testing-strategy)
* [Building and Running the application](#building-and-running-the-application)
* [The example domain](#the-example-domain)
* [Resources](#resources)
* [Contacts](#contacts)
***
## Why Clean Architecture?
> The center of your application is not the database. Nor is it one or more of the frameworks you may be using. **The center of your application is the use cases of your application** - _Unclebob_ ([source](https://blog.8thlight.com/uncle-bob/2012/05/15/NODB.html "NODB"))
Clean architecture helps us solve, or at least mitigate, these common problems with architecture:
* **Decisions are taken too early**, often at the beginning of a project, when we know the least about the problem that we have to solve
* **It's hard to change**, so when we discover new requirements we have to decide if we want to hack them in or go through an expensive and painful re-design. We all know which one usually wins. _The best architectures are the ones that allow us to defer commitment to a particular solution and let us change our mind_
* **It's centered around frameworks**. Frameworks are tools to be used, not architectures to be conformed to. Frameworks often require commitments from you, but they don’t commit to you. They can evolve in different directions, and then you’ll be stuck following their rules and quirks
* **It's centered around the database**. We often think about the database first, and then create a CRUD system around it. We end up using the database objects everywhere and treat everything in terms of tables, rows and columns
* **We focus on technical aspects** and when asked about our architecture we say things like “it’s servlets running in tomcat with an oracle db using spring”
* **It's hard to find things** which makes every change longer and more painful
* **Business logic is spread everywhere**, scattered across many layers, so when checking how something works our only option is to debug the whole codebase. Even worse, often it's duplicated in multiple places
* **Forces/Encourages slow, heavy tests**. Often our only choice for tests is to go through the GUI, either because the GUI has a lot of logic, or because the architecture doesn't allow us to do otherwise. This makes tests slow to run, heavy and brittle. It results in people not running them and the build beind broken often
* **Infrequent deploys** because it's hard to make changes without breaking existing functionalities. People resort to long-lived feature branches that only get integrated at the end and result in big releases, rather than small incremental ones
Clean architecture gives us all these benefits:
* **Effective testing strategy** that follows the [testing pyramid](http://martinfowler.com/bliki/TestPyramid.html) and gives us a fast and reliable build
* **Frameworks are isolated** in individual modules so that when (not if) we change our mind we only have to change one place, with the rest of the app not even knowing about it
* **Independent from Database**, which is treated just like any other data provider. Our app has real use cases rather than being a CRUD system
* **Screaming architecture** a.k.a. it screams its intended usage. When you look at the package structure you get a feel for what the application does rather than seeing technical details
* **All business logic is in a use case** so it's easy to find and it's not duplicated anywhere else
* **Hard to do the wrong thing** because modules enforce compilation dependencies. If you try to use something that you're not meant to, the app doesn't compile
* **We're always ready to deploy** by leaving the wiring up of the object for last or by using feature flags, so we get all the benefits of continuous integration (no need for feature branches)
* **Swarming on stories** so that different pairs can easily work on the same story at the same time to complete it quicker
* **Good monolith** with clear use cases that you can split in microservices later one, once you've learnt more about them
Of course, it comes at a cost:
* **Perceived duplication of code**. Entities might be represented differently when used in business logic, when dealing with the database and when presenting them in a json format. You might feel like you're duplicating code, but you're actually favouring _decoupling over DRY_
* **You need interesting business logic** to "justify" the structure. If all you do in your use case is a one-line method to read or save from a database, then maybe you can get away with something simpler
***
## Application Structure
<img src="docs/images/clean-architecture-diagram-1.png" alt="clean-architecture-diagram-1.png" width="700">
<img src="docs/images/clean-architecture-diagram-2.png" alt="clean-architecture-diagram-2.png" width="700">
##### Core: Entities
* Represent your domain object
* Apply only logic that is applicable in general to the whole entity (e.g. validating the format of an hostname)
* Plain java objects: no frameworks, no annotations
##### Core: Use Cases
* Represent your business actions, it’s what you can do with the application. Expect one use case for each business action
* Pure business logic, plain java (expect maybe some utils libraries like StringUtils)
* Define interfaces for the data that they need in order to apply some logic. One or more dataproviders will implement the interface, but the use case doesn’t know where the data is coming from
* The use case doesn't know who triggered it and how the results are going to be presented (e.g. could be on a web page, or returned as json, or simply logged, etc.)
* Throws business exceptions
##### Dataproviders
* Retrieve and store data from and to a number of sources (database, network devices, file system, 3rd parties, etc.)
* Implement the interfaces defined by the use case
* Use whatever framework is most appropriate (they are going to be isolated here anyway)
* Note: if using an ORM for database access, here you'd have another set of objects in order to represent the mapping to the tables (don't use the core entities as they might be very different)
##### Entrypoints
* Are ways to interact with the application, and typically involve a delivery mechanism (e.g. REST APIs, scheduled jobs, GUI, other systems)
* Trigger a use case and convert the result to the appropriate format for the delivery mechanism
* A GUI would use MVC (or MVP) in here; the controller would trigger a use case
##### Configuration
* Wires everything together
* Frameworks (e.g. for dependency injection) are isolated here
* Has the "dirty details" like Main class, web server configuration, datasource configuration, etc.
##### _Examples_
<img src="docs/images/example-1.png" alt="clean-architecture-diagram-1.png" width="700">
<img src="docs/images/example-2.png" alt="clean-architecture-diagram-1.png" width="700">
***
## Testing Strategy
<img src="docs/images/testing-strategy.png" alt="testing-strategy.png" width="700">
##### Unit Tests
* for TDD (a.k.a. Tests first, to drive design)
* Cover every little detail, aim for 100% coverage
* “Dev to dev” documentation: What should this class do?
* Test individual classes in isolation, very fast
##### Acceptance Tests
* for BDD (a.k.a. Conversations with the stakeholders)
* Demonstrate and document business requirements
* “Business” documentation: What does the system do?
* Test a use case in isolation, very fast (no GUI, no DB, etc.)
* Use your favourite BDD framework (we use [Yatspec](https://github.com/bodar/yatspec))
##### Integration Tests
* Test integration with slow parts (http, database, etc.)
* “Dev” documentation: Does this work as expected?
* Test one layer in isolation (e.g. only rest endpoint, or only data provider). Slow
* Use whatever library makes it easy (e.g. Spring MockMVC; in-memory db)
##### End-to-end Tests
* Test only the critical journeys (e.g. most common happy path)
* Demonstrate “business” end-to-end requirement
* Start the whole app, very slow. Keep these to a minimum
***
## Building and Running the application
* building the application:
```
./gradlew clean build
```
* running the application (from the jar, after having built it):
```
java -jar application/build/clean-architecture-example.jar
```
* running the application (on the fly):
```
./gradlew bootRun
```
* running the application (in the IDE): open and run the main class
```
com.clean.example.configuration.Application
```
* more info on available tasks:
```
./gradlew tasks
```
Once the application is running, you can:
* open <http://localhost:8080/broadbandaccessdevice/device1.exlon.com/> and you should see some json
* look at the log and you should see a scheduled job running every 5 seconds (it prints something like _"Job Starting: ReconcileBroadbandAccessDeviceJob..."_)
##### Importing the project in IntelliJ
* Simply open the _build.gradle_ file and IntelliJ should load everything
##### Importing the project in Eclipse
* Make sure you've installed the Gradle plugin
* "Import existing project", choose Gradle, select the main folder and follow the instructions
***
## The example domain
<img src="docs/images/example-domain.png" alt="example-domain.png" width="700">
This example application is a simplified version of a real production application that we develop at Sky. The domain is a telecommunication domain. It's a Network Inventory software that has the fulfill the following use cases:
* Capacity of an exchange: how much available space have we got in a particular exchange? can we take on more customers in that area?
* Reconcile devices: has anything changed in reality that we don't know of?
* Get details of a particular device, by hostname
***
## Resources
##### Presentation
* Real Life Clean Architecture http://www.slideshare.net/mattiabattiston/real-life-clean-architecture-61242830
##### Blogs & Articles
* The Clean Architecture https://blog.8thlight.com/uncle-bob/2012/08/13/the-clean-architecture.html
* Screaming Architecture http://blog.8thlight.com/uncle-bob/2011/09/30/Screaming-Architecture.html
* NODB https://blog.8thlight.com/uncle-bob/2012/05/15/NODB.html
* Hexagonal Architecture http://alistair.cockburn.us/Hexagonal+architecture
##### Videos & Presentations
* Clean Coders ep. 7: Architecture, Use Cases, and High Level Design https://cleancoders.com/episode/clean-code-episode-7/show
* Robert C. Martin - Clean Architecture https://vimeo.com/43612849
* Robert C. Martin - Clean Architecture and Design https://www.youtube.com/watch?v=Nsjsiz2A9mg
***
## Contacts
For any question or feedback (really appreciated!) feel free to contact me:
* Email: mattia _(dot)_ battiston _(at)_ gmail.com
* Twitter: [@BattistonMattia](https://twitter.com/BattistonMattia)
* Linkedin: [Mattia Battiston](https://uk.linkedin.com/in/mattiabattiston)
| 1 |
jsvitak/jbpm-6-examples | Examples how to use jBPM 6. | null | jbpm-6-examples
===============
Web examples for jBPM 6.2. Distributed under Apache Software License 2.0. Steps to try them can be found in their folders.
- rewards-basic
- demonstrates jBPM EJB services in combination with servlets and JSP
- rewards-cdi-jsf
- demonstrates jBPM CDI services in combination with CDI beans and JSF
| 0 |
OmarElgabry/DesignPatterns | Examples of Design Patterns in Java | design-patterns java | 
# Design Patterns
Design Patterns are solutions to common software design problems that occur over and over in software development.
## Index
+ [Structural](#structural)
+ [Behavioral](#behavioral)
+ [Creational](#creational)
+ [Support](#support)
+ [Contribute](#contribute)
+ [License](#license)
## Structural<a name="structural"></a>
### Adapter
An adapter helps to join two incompatible interfaces to work together. So, if you have an interface with implementing classes. If you were asked later to add additional sub class(es), but they have incompatible Interface, then, adapter pattern could be useful. There are two structures:
#### Object
The Adapter has a reference to the incompatible object.

#### Interface
The Adapter has a reference to the incompatible interface.

### Decorator
The decorator pattern extends the functionality of an object dynamically.

### Bridge
Decouples an abstraction from its implementation so that the two can vary independently. As an example, If you have a class called Rectangle. This class could have two different implementations, Red Rectangle and Blue one. Instead of Inheriting from Rectangle class, one for blue rectangle and another for red, We could instead pull out these implementations and use Composition over Inheritance.

### Composite
It's used to create a tree structure of group of objects. So, an Object can be collection of other objects, where objects share a common interface that defines the common operations.
An object can have a collection of objects called _Composite_ Or _Node_, while objects that can't have other objects(at the lowest level) called _Leaf_. _Composite_ object can have leafs or other composites.

## Behavioral<a name="behavioral"></a>
### Strategy
Strategy is used when you want to extend the behavior of an Object, where this behavior could vary during the run time. If multiple objects need to use the same behavior(algorithm), we get the benefit of code reuse too.

### Dependency injection
Dependency is used when you want to separate the dependencies of an Object, and pass them to dependent object during run time. The dependent object does not need to know how to construct the dependencies nor which actual dependencies it is using.

### Iterator
This pattern is used to get a way to access the elements of a collection object in sequential manner without exposing its underlying representation. In this snippet, I am using Java's built-in Iterable & Iterator classes.
#### Separate Class

#### Single Class

### Observer
Observer pattern is used such that if an object is changed, its dependents objects get notified of that change, Thus, there is 1:M Relationship. As an example, having a Publisher that publish news to the Subscribers, Whenever any new updates or data added, the Subscribers get notified. In this snippet, I am using Java's Observer and Observable classes.

### State
A class behavior may change based on set of states either made by user, or internally by the system. In this pattern, We encapsulate each state. The user doesn't need to know about each state, the user only performs some actions which in turn may change the state of the object.

## Creational<a name="creational"></a>
### Factory
This pattern defines a way for creating object(s) during run time.
#### Factory Method
Factory Method is a method used to create object(s) of a certain type(interface) during run time.

#### Abstract Factory
Factory Method is an object used to create a set of related objects during run time.

### Singleton
The Singleton Pattern is a pattern that ensures that there is only ever one single instance of a class, And it provides a global way to get to that instance.
#### Classic
This is the basic implementation

#### Eager Instantiation
If you are concerned about synchronization, eager intantiation could be useful as long as you know you'll always need to instantiate the object, and the object doesn't take a lot of time to load.

#### Synchronized
Another solution for synchronization using ```synchronized``` method. But, you will pay for it's pitfall; Synchronized code takes a lot longer to run.

### Prototype
The Portotype Pattern used when you want to hide the complexity of creating new instance same as in Factory Pattern, and Creating an object is an expensive operation. Thus, copy an existing object is much efficient. It uses Java's Cloneable Interface for cloning objects.
#### Abstract Class
Using abstract class

#### Interface
Using Interface

## Support
I've written these snippets in my free time during my studies. If you find it useful, please support the project by spreading the word.
## Contribute <a name="contribute"></a>
Contribute by creating new issues, sending pull requests on Github or you can send an email at: omar.elgabry.93@gmail.com
## License
Built under [MIT](http://www.opensource.org/licenses/mit-license.php) license.
| 0 |
vlingo/xoom-examples | The VLINGO XOOM examples demonstrating features and functionality available in the reactive components. See each of the submodules for specific examples. | actor-framework actor-model actors example-code example-project examples java jvm | # xoom-examples
[](https://gitter.im/vlingo-platform-java/examples)
[](https://github.com/vlingo/xoom-examples/actions?query=workflow%3ABuild)
The VLINGO XOOM examples demonstrating features and functionality available in the reactive components. See each of the submodules for specific examples.
Docs: https://docs.vlingo.io
| 0 |
line/armeria-examples | Armeria examples | null | # Armeria examples
- `annotated-http-service` <a href="https://gitpod.io/#project=annotated-http-service/https://github.com/line/armeria-examples/tree/main/annotated-http-service/src/main/java/example/armeria/server/annotated/Main.java">
<img align="absmiddle" height="20" src="https://gitpod.io/button/open-in-gitpod.svg"/>
</a>
- Learn how to write an HTTP service using annotations.
- See [Annotated services](https://armeria.dev/docs/server-annotated-service).
- `annotated-http-service-kotlin` <a href="https://gitpod.io/#project=annotated-http-service-kotlin/https://github.com/line/armeria-examples/tree/main/annotated-http-service-kotlin/src/main/kotlin/example/armeria/server/annotated/kotlin/Main.kt">
<img align="absmiddle" height="20" src="https://gitpod.io/button/open-in-gitpod.svg"/>
</a>
- Learn how to write an HTTP service using annotations with Kotlin Coroutines.
- See [Kotlin coroutines support](https://armeria.dev/docs/server-annotated-service#kotlin-coroutines-support).
- `context-propagation`
- Learn how to propagate Armeria's `RequestContext` for use in scenarios like tracing.
- [`dagger`](https://dagger.dev/producers) provides an example using the Dagger asynchronous framework for
automatic propagation.
- `manual` provides an example manually propagating the context with Java's standard `CompletableFuture`.
- [`reactor`](https://github.com/reactor/reactor-core/tree/3.3.x) provides an example using the Reactor
asynchronous framework for automatic propagation.
- [`rxjava`](https://github.com/ReactiveX/RxJava/tree/3.x) provides an example using the RxJava3 asynchronous
framework for automatic propagation.
- `grpc` <a href="https://gitpod.io/#project=grpc/https://github.com/line/armeria-examples/tree/main/grpc/src/main/java/example/armeria/grpc/Main.java">
<img align="absmiddle" height="20" src="https://gitpod.io/button/open-in-gitpod.svg"/>
</a>
- Learn how to write a gRPC service with Armeria gRPC module.
- See [Running a gRPC service](https://armeria.dev/docs/server-grpc) and
[Calling a gRPC service](https://armeria.dev/docs/client-grpc).
- `grpc-kotlin`
- Learn how to write a gRPC service with Armeria gRPC module (Kotlin).
- See [Running a gRPC service](https://armeria.dev/docs/server-grpc) and
[Calling a gRPC service](https://armeria.dev/docs/client-grpc).
- `grpc-reactor` <a href="https://gitpod.io/#project=grpc-reactor/https://github.com/line/armeria-examples/tree/main/grpc-reactor/src/main/java/example/armeria/grpc/reactor/Main.java">
<img align="absmiddle" height="20" src="https://gitpod.io/button/open-in-gitpod.svg"/>
</a>
- Learn how to write a gRPC service with Armeria gRPC module,
[`reactive-grpc`](https://github.com/salesforce/reactive-grpc) and
[Project Reactor](https://projectreactor.io/) libraries for asynchronous processing
with non-blocking back pressure.
- See [Running a gRPC service](https://armeria.dev/docs/server-grpc) and
[Calling a gRPC service](https://armeria.dev/docs/client-grpc).
- `proxy-server` <a href="https://gitpod.io/#project=proxy-server/https://github.com/line/armeria-examples/tree/main/proxy-server/src/main/java/example/armeria/proxy/Main.java">
<img align="absmiddle" height="20" src="https://gitpod.io/button/open-in-gitpod.svg"/>
</a>
- Learn how to make a proxy server which leverages client side load balancing.
- See [Client-side load balancing](https://armeria.dev/docs/client-service-discovery)
- `resilience4j-spring` <a href="https://gitpod.io/#project=resilience4j-spring/https://github.com/line/armeria-examples/tree/main/resilience4j-spring/src/main/java/example/armeria/resilience4j/spring/Main.java">
<img align="absmiddle" height="20" src="https://gitpod.io/button/open-in-gitpod.svg"/>
</a>
- Learn how to use Armeria with Resilience4j and Spring.
- `saml-service-provider` <a href="https://gitpod.io/#project=sam-service-provider/https://github.com/line/armeria-examples/tree/main/saml-service-provider/src/main/java/example/armeria/server/saml/sp/Main.java">
<img align="absmiddle" height="20" src="https://gitpod.io/button/open-in-gitpod.svg"/>
</a>
- Learn how to authenticate users using SAML.
- See [SAML Single Sign-on](https://armeria.dev/docs/advanced-saml).
- `server-sent-events` <a href="https://gitpod.io/#project=server-sent-events/https://github.com/line/armeria-examples/tree/main/server-sent-events/src/main/java/example/armeria/server/sse/Main.java">
<img align="absmiddle" height="20" src="https://gitpod.io/button/open-in-gitpod.svg"/>
</a>
- Learn how to serve Server-Sent Events.
- See [Serving Server-Sent Events](https://armeria.dev/docs/server-sse).
- `spring-boot-minimal` <a href="https://gitpod.io/#project=spring-boot-minimal/https://github.com/line/armeria-examples/tree/main/spring-boot-minimal/src/main/java/example/springframework/boot/minimal/Main.java">
<img align="absmiddle" height="20" src="https://gitpod.io/button/open-in-gitpod.svg"/>
</a>
- Learn how to use Armeria with the minimal Spring Boot dependencies.
- `spring-boot-minimal-kotlin`
- Learn how to use Armeria with the minimal Spring Boot dependencies (Kotlin).
- `spring-boot-tomcat` <a href="https://gitpod.io/#project=spring-boot-tomcat/https://github.com/line/armeria-examples/tree/main/spring-boot-tomcat/src/main/java/example/springframework/boot/tomcat/Main.java">
<img align="absmiddle" height="20" src="https://gitpod.io/button/open-in-gitpod.svg"/>
</a>
- Learn how to make Armeria serve your Spring Boot web application.
- `spring-boot-webflux` <a href="https://gitpod.io/#project=spring-boot-webflux/https://github.com/line/armeria-examples/tree/main/spring-boot-webflux/src/main/java/example/springframework/boot/webflux/Main.java">
<img align="absmiddle" height="20" src="https://gitpod.io/button/open-in-gitpod.svg"/>
</a>
- Learn how to make Armeria serve your Spring Boot reactive web application.
- See [Using Armeria with Spring WebFlux](https://armeria.dev/docs/advanced-spring-webflux-integration).
- `dropwizard` <a href="https://gitpod.io/#project=dropwizard/https://github.com/line/armeria-examples/tree/main/dropwizard/src/main/java/example/dropwizard/DropwizardArmeriaApplication.java">
<img align="absmiddle" height="20" src="https://gitpod.io/button/open-in-gitpod.svg"/>
</a>
- Learn how to make Armeria serve your Dropwizard web application.
- See [Using Armeria with Dropwizard](https://armeria.dev/docs/advanced-dropwizard-integration).
- `static-files` <a href="https://gitpod.io/#project=static-files/https://github.com/line/armeria-examples/tree/main/static-files/src/main/java/example/armeria/server/files/Main.java">
<img align="absmiddle" height="20" src="https://gitpod.io/button/open-in-gitpod.svg"/>
</a>
- Learn how to serve static files.
- See [Serving static files](https://armeria.dev/docs/server-http-file).
- `thrift` <a href="https://gitpod.io/#project=grpc/https://github.com/line/armeria-examples/tree/main/thrift/src/main/java/example/armeria/thrift/Main.java">
<img align="absmiddle" height="20" src="https://gitpod.io/button/open-in-gitpod.svg"/>
</a>
- Learn how to write a Thrift service with Armeria Thrift module.
- See [Running a Thrift service](https://armeria.dev/docs/server-thrift) and
[Calling a Thrift service](https://armeria.dev/docs/client-thrift).
- Install Thrift compiler locally before generating Thrift services.
- Use `brew install thrift` for macOS.
## Configure `-parameters` javac option
You can omit the value of `@Param` if you compiled your code with `-parameters` javac option.
Please refer to [Configure `-parameters` javac option](https://armeria.dev/docs/setup#configure--parameters-javac-option) for more information.
## How to run
- Use `run` or `bootRun` task to run an example from Gradle.
- See [Open an existing Gradle project](https://www.jetbrains.com/help/idea/gradle.html#gradle_import_project_start) to import an example into IntelliJ IDEA.
- See [Configure `-parameters` javac option](https://armeria.dev/docs/setup#configure--parameters-javac-option) to configure IntelliJ IDEA.
- See [Build and run the application](https://www.jetbrains.com/help/idea/creating-and-running-your-first-java-application.html#run_app) to run an example from IntelliJ IDEA.
## License
All files under this directory (`examples`) belong to
[the public domain](https://en.wikipedia.org/wiki/Public_domain).
Please feel free to copy-and-paste and start your awesome project with Armeria!
| 0 |
gauravrmazra/gauravbytes | Examples for gauravbytes.com | apache-avro bigdata docker elasticsearch elk-stack imdg java java-8 jupyter-notebook mongodb pandas-dataframe spring spring-boot spring-cloud spring-mvc | # gauravbytes
examples for gauravbytes.com
| 0 |
RameshMF/Hibernate-ORM-Tutorials | 40+ source code Examples/Tutorials/Guides of Hibernate ORM Framework | hibernate hibernate-configurations hibernate-framework hibernate-orm-framework jpa jpa-persistence-applications | # Hibernate-ORM-Tutorials
Tutorials/guides/examples of Hibernate ORM Framework
<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="font-family-page">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-LZZRjsO24YI/W_qbPQkNsTI/AAAAAAAAE9o/Urok6r0IKbkPtRU6V7r5ty5eMOcaKiKAgCLcBGAs/s1600/hibernate-logo.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="139" data-original-width="491" src="https://3.bp.blogspot.com/-LZZRjsO24YI/W_qbPQkNsTI/AAAAAAAAE9o/Urok6r0IKbkPtRU6V7r5ty5eMOcaKiKAgCLcBGAs/s1600/hibernate-logo.jpg"></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div>
This tutorial is designed for all those Java programmers who would like to understand the Hibernate framework and its API. All the examples in this tutorial have been developed using Hibernate 5.3 +.</div>
<h2 style="text-align: left;">
1. Hibernate Getting Started</h2>
<div>
<div style="text-align: left;">
</div>
<ul style="text-align: left;">
<li><a href="http://www.javaguides.net/2018/11/hibernate-framework-overview-architecture-bascis.html" target="_blank">Hibernate Framework Overview - Architecture and Basics</a> - In this article, b<span style="background-color: white; color: #24292e; font-family: , "blinkmacsystemfont" , "segoe ui" , "helvetica" , "arial" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol"; font-size: 16px;">efore getting started with Hibernate framework, let's familiar with a few basic concepts of the hibernate framework, it's architecture, it's benefits and advantages over JDBC etc.</span></li>
</ul>
<div style="text-align: left;">
</div>
<ul style="text-align: left;">
<li><a href="http://www.javaguides.net/2018/11/hibernate-hello-world-tutorial.html">Hibernate 5 - Hello World Tutorial</a> - In this Hibernate hello world tutorial, we will show you how to create a Hibernate Application to connect MySQL database.</li>
</ul>
<ul style="text-align: left;">
<li><a href="http://www.javaguides.net/2018/12/hibernate-transaction-management-tutorial.html" target="_blank">Hibernate Transaction Management Tutorial</a> - In this tutorial, we will learn how to manage transactions in Hibernate applications.</li>
</ul>
</div>
<h2 style="text-align: left;">
2. Bootstrap</h2>
<h3 style="text-align: left;">
2.1 Native Bootstrapping</h3>
<div style="text-align: left;">
</div>
<ul style="text-align: left;">
<li><a href="http://www.javaguides.net/2018/11/hibernate-5-xml-configuration-example.html" style="font-family: inherit;">Hibernate 5 XML Configuration Example</a><span style="font-family: inherit;"> - In this article, we will show you how to create a Hibernate Application using hibernate.cfg.xml configuration to connect MySQL database.</span></li>
</ul>
<ul style="text-align: left;">
<li><a href="http://www.javaguides.net/2018/11/hibernate-5-java-configuration-example.html" style="font-family: inherit;">Hibernate 5 Java Configuration Example</a><span style="font-family: inherit;"> - In this article, we will show you how to create a Hibernate Application using Java configuration without using hibernate.cfg.xml to connect MySQL database.</span></li>
</ul>
<ul style="text-align: left;">
<li><a href="http://www.javaguides.net/2018/11/hibernate-configurations-quick-references.html" style="font-family: inherit; font-size: 16px;" target="_blank">Hibernate Configurations Quick References [Snippets]</a><span style="background-color: white; color: #24292e; font-family: inherit; font-size: 16px;"> - </span><span style="color: #24292e; font-family: inherit; font-size: 16px;">This post is a quick</span><span style="color: #24292e; font-family: inherit; font-size: 16px;"> reference to Hibernate XML or Java-based configuration.</span></li>
</ul>
</div>
<h3 style="text-align: left;">
2.2 JPA Bootstrapping</h3>
<div class="font-family-page">
<div>
<ul style="text-align: left;">
<li><span style="background-color: white; color: #24292e; font-family: , "blinkmacsystemfont" , "segoe ui" , "helvetica" , "arial" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol"; font-size: 16px;"><a href="http://www.javaguides.net/2018/11/jpa-with-hibernate-5-bootstrapping-example.html" target="_blank">JPA 2 with Hibernate 5 Bootstrapping Example</a> - </span><span style="background-color: white; color: #24292e; font-family: , "blinkmacsystemfont" , "segoe ui" , "helvetica" , "arial" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol"; font-size: 16px;">In this post, we will show you how to create or configure a simple JPA application with Hibernate.</span></li>
</ul>
<h2 style="text-align: left;">
3. Domain Model</h2>
<ul style="text-align: left;">
<li><span style="background-color: white; color: #24292e; font-family: inherit; font-size: 16px;"><a href="http://www.javaguides.net/2018/11/guide-to-jpa-and-hibernate-cascade-types.html" target="_blank">Guide to JPA and Hibernate Cascade Types</a> - J</span><span style="background-color: white; color: #24292e; font-family: inherit; font-size: 16px;">PA allows you to propagate the state transition from a parent entity to a child. This article describes all cascade types with an example.</span></li>
</ul>
<ul style="text-align: left;">
<li><span style="background-color: white; color: #24292e; font-family: inherit; font-size: 16px;"><a href="http://www.javaguides.net/2018/12/hibernatejpa-primary-key-generation-stratergies.html" target="_blank">Hibernate/JPA - Primary Key Generation Strategies</a> - Let's discuss </span><span style="background-color: white; color: #24292e; font-family: inherit; font-size: 16px;">4 different primary key generation strategies which generate the primary key values programmatically or use database features, like auto-incremented columns or sequences.</span></li>
</ul>
<ul style="text-align: left;">
<li><a href="http://www.javaguides.net/2018/11/hibernate-5-enum-type-mapping-example.html">Hibernate 5 - Enum Type Mapping Example</a> - In this article, we will show you how a Java enum type is persisted into a database.</li>
</ul>
<ul style="text-align: left;">
<li><a href="http://www.javaguides.net/2018/11/hibernate-component-mapping-using-embeddable-embedded-annotation.html" target="_blank">Hibernate Component Mapping Using @Embeddable and @Embedded Annotation</a> - <span style="background-color: white; color: #24292e; font-size: 16px;">With Hibernate we can use the </span><span style="background-color: rgba(27 , 31 , 35 , 0.05); color: #d73a49; font-family: "consolas" , "liberation mono" , "courier" , monospace; font-size: 14.4px; padding: 0.2em 0.4em;">@Embeddable</span><span style="background-color: white; color: #24292e; font-size: 16px;"> annotation to mark a class to be eligible as an embeddable class.</span></li>
</ul>
<span style="background-color: white; color: #24292e; font-family: , "blinkmacsystemfont" , "segoe ui" , "helvetica" , "arial" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol"; font-size: 16px;"></span></div>
<h2 style="text-align: left;">
4. Hibernate Database Operations (Session Methods)</h2>
<ul style="text-align: left;">
<li><a href="http://www.javaguides.net/2018/11/hibernate-save-an-entity-example.html">Hibernate 5 - Save an Entity Example</a> - In this article, we will create a simple Hibernate application to demonstrate how to save an entity into a database.</li>
</ul>
<ul style="text-align: left;">
<li><a href="http://www.javaguides.net/2018/11/hibernate-persist-entity-example.html">Hibernate 5 - Persist an Entity Example</a> - In this article, we will create a simple Hibernate application to demonstrate how to persist an entity into a database.</li>
</ul>
<ul style="text-align: left;">
<li><a href="http://www.javaguides.net/2018/11/hibernate-saveorupdate-method-example.html">Hibernate 5 - saveOrUpdate() Method Example</a> - In this article, we will create a simple Hibernate application to demonstrate how to save or update an entity in the database using the saveOrUpdate() method.</li>
</ul>
<ul style="text-align: left;">
<li><a href="http://www.javaguides.net/2018/11/hibernate-get-load-and-byid-method-examples.html">Hibernate 5 - get(), load() and byId() Method Examples</a> - In this article, we will show you how to use Session.get(), Session.load() and Session.byId() methods to retrieve an entity from database.</li>
</ul>
<ul style="text-align: left;">
<li><a href="http://www.javaguides.net/2018/11/hibernate-merge-example.html">Hibernate 5 - merge() Example</a> - In this article, we will show you how to use Session.merge() method to merge an entity in Hibernate Application.</li>
</ul>
<ul style="text-align: left;">
<li><a href="http://www.javaguides.net/2018/11/hibernate-delete-or-remove-entity.html">Hibernate 5 - Delete or Remove an Entity Example</a> - In Hibernate, an entity can be removed from a database by calling the Session.delete() or Session.remove(). Using these methods, we can remove a transient or persistent object from datastore.</li>
</ul>
<ul style="text-align: left;">
<li><a href="http://www.javaguides.net/2018/11/hibernate-5-load-method-example.html">Hibernate 5 - load() Method Example</a> - In this article, we will create a simple Hibernate application using Java configuration without using hibernate.cfg.xml to demonstrates the usage of Session.load() method.</li>
</ul>
<ul style="text-align: left;">
<li><a href="http://www.javaguides.net/2018/11/hibernate-5-c3p0-connection-pool-example.html">Hibernate 5 c3p0 Connection Pool Example</a> - In this article, we will show how to use c3p0 connection pooling in hibernate applications.</li>
</ul>
<h2 style="text-align: left;">
5. Inheritance Mapping</h2>
<div style="text-align: left;">
<ul style="text-align: left;">
<li><a href="http://www.javaguides.net/2018/11/hibernate-5-inheritance-mapping.html" target="_blank">Hibernate 5 - Inheritance Mapping</a> - In this article, we will learn 4 inheritance<span style="background-color: white; font-family: , "blinkmacsystemfont" , "segoe ui" , "helvetica" , "arial" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol"; font-size: 16px;"> strategies with examples.</span></li>
</ul>
<ul style="text-align: left;">
<li><span style="background-color: white; font-family: , "blinkmacsystemfont" , "segoe ui" , "helvetica" , "arial" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol"; font-size: 16px;"><a href="http://www.javaguides.net/2018/11/hibernate-jpa-mappedsuperclass-inheritance-example.html" target="_blank">Hibernate/JPA MappedSuperclass Inheritance Example</a> - </span><span style="background-color: white; color: #24292e; font-family: , "blinkmacsystemfont" , "segoe ui" , "helvetica" , "arial" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol"; font-size: 16px;">The JPA standard specification defines the </span><a href="https://docs.oracle.com/javaee/7/api/javax/persistence/MappedSuperclass.html" style="color: #3d85c6; font-size: 16px;" target="_blank">@MappedSuperclass</a><span style="background-color: white; color: #24292e; font-family: , "blinkmacsystemfont" , "segoe ui" , "helvetica" , "arial" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol"; font-size: 16px;"> annotation to allow an entity to inherit properties from a base class.</span></li>
</ul>
<div style="text-align: left;">
</div>
<ul style="text-align: left;">
<li><span style="background-color: white; color: #24292e; font-family: , "blinkmacsystemfont" , "segoe ui" , "helvetica" , "arial" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol"; font-size: 16px;"><a href="http://www.javaguides.net/2018/11/hibernatejpa-single-table-inheritance.html" target="_blank">Hibernate/JPA Single Table Inheritance Example</a> - </span><span style="background-color: white; color: #24292e; font-family: , "blinkmacsystemfont" , "segoe ui" , "helvetica" , "arial" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol"; font-size: 16px;"> </span><span style="background-color: white; color: #24292e; font-family: , "blinkmacsystemfont" , "segoe ui" , "helvetica" , "arial" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol"; font-size: 16px;">In this article, we will discuss The single table strategy which maps all entities of the inheritance structure to the same database table.</span></li>
</ul>
<ul style="text-align: left;">
<li><span style="background-color: white; color: #24292e; font-family: , "blinkmacsystemfont" , "segoe ui" , "helvetica" , "arial" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol"; font-size: 16px;"><a href="http://www.javaguides.net/2018/11/hibernate-jpa-joined-table-inheritance-example.html" target="_blank">Hibernate JPA Joined Table Inheritance Example</a> - </span><span style="background-color: white; color: #24292e; font-family: , "blinkmacsystemfont" , "segoe ui" , "helvetica" , "arial" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol"; font-size: 16px;">In this article, we will discuss The Joined table strategy or table-per-subclass mapping strategy.</span></li>
</ul>
<ul style="text-align: left;">
<li><span style="background-color: white; color: #24292e; font-family: , "blinkmacsystemfont" , "segoe ui" , "helvetica" , "arial" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol"; font-size: 16px;"><a href="http://www.javaguides.net/2018/11/hibernatejpa-table-per-class-inheritance-example.html" target="_blank">Hibernate/JPA Table Per Class Inheritance Example</a> - </span><span style="background-color: white; color: #24292e; font-family: , "blinkmacsystemfont" , "segoe ui" , "helvetica" , "arial" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol"; font-size: 16px;">In this article, we’ll look into Hibernate/JPA table per class inheritance.</span></li>
</ul>
</div>
<span style="background-color: white; color: #24292e; font-family: , "blinkmacsystemfont" , "segoe ui" , "helvetica" , "arial" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol"; font-size: 16px;"></span></div>
<div class="font-family-page">
<h2 style="text-align: left;">
6. Hibernate Query Language</h2>
<div style="text-align: left;">
</div>
<ul style="text-align: left;">
<li><a href="http://www.javaguides.net/2018/11/hibernate-query-language-basics.html">Hibernate Query Language Basics</a> - This article describes the basics of HQL.</li>
</ul>
<ul style="text-align: left;">
<li><a href="http://www.javaguides.net/2018/11/hibernate-query-language-insert-update.html">Hibernate Query Language INSERT, UPDATE, SELECT and DELETE Example</a> - In this article, we will discuss how to create simple Hibernate Query Language INSERT, UPDATE, SELECT and DELETE Example.</li>
</ul>
<ul style="text-align: left;">
<li><a href="http://www.javaguides.net/2018/11/hibernate-5-hql-crud-example-snippets.html">Hibernate 5 - HQL CRUD Example [Snippets]</a> - In this article, we will see quick snippets or examples of Hibernate 5 HQL CRUD Example.</li>
</ul>
<ul style="text-align: left;">
<li><a href="http://www.javaguides.net/2018/11/hibernate-5-named-query-tutorial-with-examples.html">Hibernate 5 Named Query Tutorial with Examples</a> - This tutorial shows you how to use the named queries annotations in hibernation application.</li>
</ul>
<div class="font-family-page">
<h2 style="text-align: left;">
7. Hibernate 5 with Java 8</h2>
<ul style="text-align: left;">
<li><a href="http://www.javaguides.net/2018/11/hibernate-5-persist-java-8-localdate-localdatetime-and-duration-example.html">Hibernate 5 - Persist Java 8 LocalDate, LocalDateTime and Duration Example</a> - In this article, we will learn how to persist Java 8 LocalDate, LocalDateTime, and Duration with <a href="http://www.javaguides.net/p/hibernate-tutorial.html">Hibernate 5</a>.</li>
</ul>
<ul style="text-align: left;">
<li><a href="https://thoughts-on-java.org/use-java-8-optional-hibernate/" target="_blank">How to use Java 8’s Optional with Hibernate</a> - This article show you how to use Java 8 Optional Class to handle <i>NullPointerException</i>.</li>
</ul>
<ul style="text-align: left;">
<li><a href="https://thoughts-on-java.org/get-query-results-stream-hibernate-5/">How to get query results as a Stream with Hibernate 5.2</a> - This post shows you how to use stream() method that allows you to process the query results as a Java 8 Stream.</li>
</ul>
</div>
<div class="font-family-page">
<h2 style="text-align: left;">
8. Database</h2>
<div>
<div style="text-align: left;">
</div>
<ul style="text-align: left;">
<li><span style="background-color: white; color: #24292e; font-family: inherit; font-size: 16px;"><a href="http://www.javaguides.net/2018/11/guide-to-hibernate-5-schema-generation.html" target="_blank">Guide to Hibernate 5 Schema Generation</a> - </span><span style="background-color: white; color: #24292e; font-family: inherit; font-size: 16px;">In this guide, You will learn how does Hibernate allows you to generate the database from the entity mappings. In this guide, we will following points.</span></li>
</ul>
<ul style="text-align: left;">
<li><span style="background-color: white; color: #24292e; font-family: inherit; font-size: 16px;"><a href="http://www.javaguides.net/2018/11/guide-to-hibernate-native-sql-queries.html" target="_blank">Guide to Hibernate Native SQL Queries</a> - </span><span style="background-color: white; color: #24292e; font-family: inherit; font-size: 16px;">Let's learn more about Hibernate native SQL queries with examples snippets.</span></li>
</ul>
<ul style="text-align: left;">
<li><span style="background-color: white; color: #24292e; font-family: inherit; font-size: 16px;"><a href="http://www.javaguides.net/2018/11/hibernate-5-using-stored-procedures-for.html" target="_blank">Hibernate 5 - Using Stored Procedures for Querying</a> - </span><span style="font-family: inherit;">Hibernate</span><span style="background-color: white; color: #24292e; font-family: inherit; font-size: 16px;"> provides support for queries via stored procedures and functions</span></li>
</ul>
<h2 style="text-align: left;">
<span style="color: #24292e;">Hibernate Annotations</span></h2>
</div>
<div>
<div style="text-align: left;">
</div>
<div style="text-align: left;">
</div>
<ul style="text-align: left;">
<li><a href="http://www.javaguides.net/2018/12/all-hibernate-mapping-annotations.html" target="_blank">All Hibernate Annotations: Mapping Annotations</a> - A quick reference to all Hibernate mapping annotations.</li>
</ul>
<ul style="text-align: left;">
<li><a href="http://www.javaguides.net/2018/11/all-jpa-annotations-mapping-annotations.html" target="_blank">All JPA Annotations: Mapping Annotations</a> - A quick reference to all JPA mapping annotations.</li>
</ul>
<ul style="text-align: left;">
<li><a href="http://www.javaguides.net/2018/11/hibernate-component-mapping-using-embeddable-embedded-annotation.html" target="_blank">Hibernate Component Mapping Using @Embeddable and @Embedded Annotation</a> - <span style="background-color: white; color: #24292e; font-size: 16px;">With Hibernate we can use the </span><span style="background-color: rgba(27 , 31 , 35 , 0.05); color: #d73a49; font-family: "consolas" , "liberation mono" , "courier" , monospace; font-size: 14.4px; padding: 0.2em 0.4em;">@Embeddable</span><span style="background-color: white; color: #24292e; font-size: 16px;"> annotation to mark a class to be eligible as an embeddable class.</span></li>
</ul>
<br>
<div>
<br></div>
</div>
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-sZpG0bMK5xQ/W_qZl9AuksI/AAAAAAAAE9U/2aimw3DF5pUZzeAOmN7xiLc59GTqRaNIQCEwYBhgL/s1600/spring-hibernate.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="282" data-original-width="600" src="https://3.bp.blogspot.com/-sZpG0bMK5xQ/W_qZl9AuksI/AAAAAAAAE9U/2aimw3DF5pUZzeAOmN7xiLc59GTqRaNIQCEwYBhgL/s1600/spring-hibernate.jpg"></a></div>
<br>
<h2 style="text-align: left;">
9. Spring Boot 2 + Hibernate 5 Tutorials</h2>
<div>
<ul style="text-align: left;">
<li><a href="http://www.javaguides.net/2018/09/spring-boot-2-hibernate-5-mysql-crud-rest-api-tutorial.html">Spring Boot 2 Hibernate 5 MySQL CRUD REST API Tutorial</a> - In this tutorial, we will learn how to develop CRUD RESTFul API using Spring boot 2, Hibernate 5, JPA, Maven, and MySQL database.</li>
</ul>
<ul style="text-align: left;">
<li><a href="http://www.javaguides.net/2018/09/spring-mvc-using-spring-boot2-jsp-jpa-hibernate5-mysql-example.html">Spring MVC + Spring Boot2 + JSP + JPA + Hibernate 5 + MySQL Example</a> - In this article, we will learn how to develop a Spring MVC web application using Spring MVC, Spring boot 2, JSP, Hibernate 5, JPA, Maven, and MySQL database.</li>
</ul>
<ul style="text-align: left;">
<li><a href="http://www.javaguides.net/2018/11/spring-boot-spring-mvc-spring-security-hibernate-mysql-tutorial.html">Spring Boot + Spring MVC + Spring Security + Hibernate + MySQL Tutorial</a> - In this article, we discuss how to create a user registration form with Spring Boot, Spring Security, Hibernate and Thymeleaf. We will develop a simple User Registration Module using Role-based Spring security which can use in any spring MVC based projects.</li>
</ul>
</div>
<h2 style="text-align: left;">
10. Spring MVC 5 + Hibernate 5 Tutorials</h2>
<div>
<div style="text-align: left;">
</div>
<ul style="text-align: left;">
<li><a href="http://www.javaguides.net/2018/11/spring-mvc-5-hibernate-5-jsp-mysql-crud-tutorial.html">Spring MVC 5 + Hibernate 5 + JSP + MySQL CRUD Tutorial</a> - In this spring hibernate integration tutorial, we will learn how to create <a href="http://www.javaguides.net/p/spring-mvc-tutorial.html">Spring MVC </a>5 web application, handle form submission, integrate hibernate 5 to connect to the backend database. In this tutorial, we will integrate <a href="http://www.javaguides.net/p/spring-mvc-tutorial.html">Spring MVC 5+</a> with Hibernate ORM framework using Java-based configuration without any XML configuration.</li>
</ul>
<ul style="text-align: left;">
<li><a href="http://www.javaguides.net/2018/11/spring-mvc-5-spring-data-jpa-hibernate-jsp-mysql-tutorial.html">Spring MVC 5 + Spring Data JPA + Hibernate 5 + JSP + MySQL Tutorial</a> - In this tutorial, we will discuss the integration of <a href="http://www.javaguides.net/p/spring-mvc-tutorial.html">Spring MVC 5</a>, <a href="http://www.javaguides.net/p/spring-data-jpa-tutorial.html">Spring Data JPA</a>, Hibernate 5 and MySQL CRUD example. We will demonstrate CRUD(Create, Retrieve, Update, Delete) operations on a Customer entity as well as display list of customers from the MySQL database.</li>
</ul>
<ul style="text-align: left;">
<li><a href="http://www.javaguides.net/2018/11/spring-mvc-5-hibernate-5-xml-based-configuration-example.html">Spring MVC 5 + Hibernate 5 XML Based Configuration Example</a> - In this tutorial, we will integrate <a href="http://www.javaguides.net/p/spring-mvc-tutorial.html">Spring MVC </a>with Hibernate ORM framework using XML-based configuration.</li>
</ul>
</div>
</div>
</div>
| 0 |
jetty-project/embedded-jetty-websocket-examples | Embedded Jetty WebSocket Examples | java11 jetty websocket websocket-client websocket-server | # WebSockets on Embedded Jetty
This project contains examples on using WebSockets with Embedded Jetty.
Note: If you want to use CDI + websockets with Jetty, check out the example project at
https://github.com/jetty-project/embedded-jetty-weld
There are 2 APIs you can use with Jetty, the native WebSocket API and the javax.websocket API.
# Project: javax.websocket-example
Demonstration of how to create a WebSocket Client or a WebSocket Server using `javax.websocket` APIs.
# Project: native-jetty-websocket-example
Demonstration of how to create a WebSocket Client or WebSocket Server using `org.eclipse.jetty.websocket` APIs.
| 0 |
lokeshgupta1981/Spring-Boot-Examples | null | null | # Spring-Boot-Examples
| 0 |
strimzi/client-examples | Example clients for use with Strimzi | null | [](https://dev.azure.com/cncf/strimzi/_build/latest?definitionId=33&branchName=main)
[](http://www.apache.org/licenses/LICENSE-2.0)
[](https://twitter.com/strimziio)
# Client examples
This repository contains examples of [Apache Kafka®](https://kafka.apache.org) client applications written using the Apache Kafka Java APIs:
* Message Producer which periodically produces messages into a topic
* Streams application which reads messages from a topic, transforms them (reverses the message payload) and sends them to another topic
* Consumer which is consuming messages from a topic
All examples are assembled into Docker images which allows them to be deployed on Kubernetes or OpenShift.
This may serve as a basic usage example for the [Strimzi project](https://strimzi.io).
This repository contains `Deployments` for the clients as well as `KafkaTopic` and `KafkaUsers` for use by Strimzi operators.
Logging configuration can be found in the `log4j2.properties` file for the producer and consumer separately.
## Build
The pre-built images are available on our Docker Hub.
But if you want to do any modifications to the examples, you will need to build your own versions.
To build these examples you need some basic requirements.
Make sure you have `make`, `docker`, `JDK 1.8` and `mvn` installed.
After cloning this repository to your folder Hello World example is fully ready to be build.
By one single command Java sources are compiled into JAR files, Docker images are created and pushed to repository.
By default the Docker organization to which images are pushed is the one defined by the `USER` environment variable which is assigned to the `DOCKER_ORG` one.
The organization can be changed exporting a different value for the `DOCKER_ORG` and it can also be the internal registry of an OpenShift running cluster.
The command for building the examples is:
```
make all
```
## Usage
Basic requirement to run this example is a Kubernetes cluster with Strimzi managed Apache Kafka cluster deployed.
Examples how to deploy Apache Kafka using Strimzi can be found on the [Strimzi website](https://strimzi.io/quickstarts/minikube/).
After successfully building the images (which will cause the images to be pushed to the specified Docker repository) you are ready to deploy the producer and consumer containers along with Kafka and Zookeper.
You can deploy the examples individually by applying [`java-kafka-producer.yaml`](./java/kafka/java-kafka-producer.yaml), [`java-kafka-consumer.yaml`](./java/kafka/java-kafka-consumer.yaml) and [`java-kafka-streams.yaml`](./java/kafka/java-kafka-streams.yaml) files.
This will create Kubernetes `Deployments` with the example image.
The second option is to apply `deployment.yaml` file.
This deploys the producer, consumer and streams and also creates the topics they are using.
If you built your own version of these examples, remember to update the `image` field with the path where the image was pushed during the build and it's available (i.e. `<my-docker-org>/java-kafka-consumer:latest`).
When using [`deployment.yaml`](./java/kafka/deployment.yaml) file for deployment you can start observing the sending messages in producer container's log and the receiving of messages in consumer container's log.
It's also available as a [`deployment-ssl.yaml`](./java/kafka/deployment-ssl.yaml) which deploys the same producer and consumer applications but using a TLS encryption and [`deployment-ssl-auth.yaml`](./java/kafka/deployment-ssl-auth.yaml) which uses TLS client authentication and ACLs.
You can also use these example clients with OAuth authentication. See the example [`deployment-oauth.yaml`](./java/kafka/deployment-oauth.yaml) for more details.
To run the OAuth example, you will need to have your Kafka cluster configured with OAuth and change the configuration in [`deployment-oauth.yaml`](./java/kafka/deployment-oauth.yaml) to point to your OAuth server.
## Configuration
Below are listed and described the available environment variables that can be used for configuration.
Producer
* `STRIMZI_TOPIC` - the topic the producer will send to
* `STRIMZI_DELAY_MS` - the delay, in ms, between messages
* `STRIMZI_MESSAGE_COUNT` - the number of messages the producer should send
* `STRIMZI_MESSAGE` - the message the producer will send
* `STRIMZI_LOG_LEVEL` - logging level
* `STRIMZI_HEADERS` - custom headers list separated by commas of `key1=value1, key2=value2`
* `STRIMZI_TRACING_SYSTEM` - if it's set to or `opentelemetry`, this will enable tracing.
Consumer
* `STRIMZI_TOPIC` - name of topic which consumer subscribes
* `STRIMZI_MESSAGE_COUNT` - the number of messages the consumer should receive
* `STRIMZI_LOG_LEVEL` - logging level
* `STRIMZI_TRACING_SYSTEM` - if it's set to `opentelemetry`, this will enable tracing.
Streams
* `STRIMZI_SOURCE_TOPIC` - name of topic which will be used as the source of messages
* `STRIMZI_TARGET_TOPIC` - name of topic where the transformed messages are sent
* `STRIMZI_LOG_LEVEL` - logging level
* `STRIMZI_TRACING_SYSTEM` - if it's set to `opentelemetry`, this will enable tracing.
Additionally, any Kafka Consumer API, Kafka Producer API or Kafka Streams API configuration option can be passed as an environment variable.
It should be prefixed with `KAFKA_` and use `_` instead of `.`.
For example environment variable `KAFKA_BOOTSTRAP_SERVERS` will be used as the `bootstrap.servers` configuration option in the Kafka Consumer API.
### Tracing
The examples support tracing using the [OpenTelemetry Java Instrumentation](https://github.com/open-telemetry/opentelemetry-java-instrumentation).
To enable tracing, configure the Tracer using [environment variables](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/configuration/sdk-environment-variables.md).
To run Opentelemetry Tracing, you can also use the provided example in [`deployment-tracing-opentelemetry.yaml`](./java/kafka/deployment-tracing-opentelemetry.yaml).
CAUTION: Strimzi no longer supports OpenTracing.
If you were previously using OpenTracing with these examples, we encourage you to transition to using OpenTelemetry instead.
## Container signatures
From the 0.38.0 release, Strimzi containers are signed using the [`cosign` tool](https://github.com/sigstore/cosign).
Strimzi currently does not use the keyless signing and the transparency log.
To verify the container, you can copy the following public key into a file:
```
-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAET3OleLR7h0JqatY2KkECXhA9ZAkC
TRnbE23Wb5AzJPnpevvQ1QUEQQ5h/I4GobB7/jkGfqYkt6Ct5WOU2cc6HQ==
-----END PUBLIC KEY-----
```
And use it to verify the signature:
```
cosign verify --key strimzi.pub quay.io/strimzi-examples/java-kafka-consumer:latest --insecure-ignore-tlog=true
``` | 1 |
Iteratr-Learning/Real-World-Software-Development | Examples for our book: Real-World Software Development | null | This is the sample code for the book "Real World Software Development"
written by Richard Warburton and Raoul-Gabriel Urma and published by
O'Reilly Media.
Full details can be found online at http://shop.oreilly.com/product/0636920053996.do
| 0 |
langmi/spring-batch-examples | Collection of Spring Batch Examples | null | # Spring Batch Examples
Collection of Spring Batch Examples, covering the basics, [readers][readers], [writers][writers], [listeners][listeners] and complex usecases.
## Why?
Spring Batch Examples exist, because i needed a central place to store the source code of my own examples collection. Instead of the usual private Subversion repository i wanted to give Github a try.
## What?
The Examples are described in each of the submodule README.
## How?
This repository uses [git submodules][git-submodules] to link to the individual example repositories on github. Right after the check-out you need to run: `git submodule --init` to get the submodule sources.
To get the latest commits for the submodules:
* [update submodules from with git command][git-update-submodules]: `git submodule -q foreach git pull -q origin master`
* [sourcetree][sourcetree]: just fetch/pull from the current repository, sourcetree will update the submodules too
## General Informations
All Spring Batch Examples:
* are individual github repositories and maven projects, the pom.xml in this root directory is only for a convenient _build all_ feature
* are tested with:
* Spring Batch 2.1.8.RELEASE
* Spring Framework 3.1.0.RELEASE
* are provided "as is", no guarantees :-)
* work with [in-memory database][database], but not with in-memory jobrepository, since the [MapJobRepository is threadsafe][maprepo-threadsafe] i could use it, but why break a standard configuration ?
Overview for the project setup.
### Maven Configuration
The pom.xml in this root directory contains just a simple parent pom wrapper project to provide a convenient "build all" feature, see [Maven Pom project aggregation][project-aggregation].
Each individual project stands on its own and can be used as such, e.g. there are no maven configurations made in the parent pom.
The examples modules are:
* spring batch examples parent, the mentioned "build all" parent module
* complex, contains examples which use more than one of the core aspects of spring batch
* listeners
* playground, mostly for incubating new examples
* readers
* writers
#### Usable Systemproperties
* -DreuseForks
* run tests with individual and fresh JVM per test class or reuse JVM between tests
* default is `false`
* use `true`, if you want to run the tests with shared JVMs
#### Specific Build Configurations
For each project i added specific build configurations for the following build plugins:
* [maven-compiler-plugin][maven-compiler-plugin]
* JDK set to 1.6
* compiler.debug=true
* compiler.optimize=false
* [maven-enforcer-plugin][maven-enforcer-plugin]
* enforce minimum Java version 1.6
* enforce minimum Maven version 3.0
* [maven-resources-plugin][maven-resources-plugin]
* forced UTF-8 encoding
* [maven-surefire-plugin][maven-surefire-plugin]
* set log4j properties file location
* Java memory configuration to prevent OutOfMemory problems during tests, see [Java -X options][java-x-options]
* [forkCount][forkCount]=1C to run one test class per cpu core
* [reuseForks][reuseForks]=false to run each test class isolated
* can be overridden by using systemproperty `-DreuseForks=true`
##### Why isolated tests?
I use the [reuseForks=false][reuseForks] for the maven test configuration to get a new JVM for each test class. This configuration lowers the test run time by a signifikant amount. Why is that necessary?
While using the HSQLDB in-memory database i see sometimes thread problems.
#### Dependencies
Each project contains only the needed dependencies and i check regularly for version updates and the [dependencies licenses][license].
### Directory Structure
The project follows the [maven standard directory layout][standard-dir-layout], only difference so far is a README.md (md for markdown format) and a LICENSE file instead of both files ending with .txt.
### Important /resources Directories and Files
Overview:
# log4j configuration
src/main/resources/log4j/log4.properties
# the job configurations
src/main/resources/spring/batch/job/
# spring batch setup
src/main/resources/spring/batch/setup/job-context.xml
src/main/resources/spring/batch/setup/job-database.xml
# the used input files
src/test/resources/input/
# test setup
src/test/resources/spring/batch/setup/test/job-test-context.xml
For each project:
* the log4j.properties is under `src/main/resources/log4j/log4j.properties`
* logging level is WARN for all and DEBUG for the source package of the project
* location might be changed soon to src/test...
* the Spring Batch infrastructure setup is under `src/main/resources/spring/batch/setup/...`
* `job-context.xml` contains JobRepository, StepScope etc. beans
* `job-database.xml` contains the datasource and transactionmanager beans
* [HSQLDB in-memory][hsqldb-in-memory] variant is used
* Spring Batch Schema is loaded at Application Context startup with [jdbc:initialize-database][jdbc-init-db]
* the Spring Batch test infrastructure setup is under `src/test/resources/spring/batch/setup/test/...`
* `job-test-context.xml` contains just the [JobLauncherTestUtils][JobLauncherTestUtils] bean
### Code Structure
* each example has its own package (test package has the same name), e.g. `simplelist`
* not all examples have java source, some have only a job.xml and some tests
* each example has its own job.xml, e.g. `simple-list-job.xml`
* each example has a large test coverage, well what can i say, i am addicted to tests :-)
## License
To simplify it, all work is under [Apache 2.0 license][apache-license], fork it, use it, bend it and if you find a bug or improvement, do not hesitate to push a patch.
### Licenses of used Java libraries
**last check: 29.04.2013**
* AOP Alliance - [Public Domain][aop-dependency]
* Apache commons-collections, -dbcp, -io, -logging, -pool - all licensed under Apache 2.0
* bcprov - [MIT][bcprov-dependency]
* harmcrest-core - [new BSD][hamcrest-dependency]
* HSQLDB - [based on BSD][hsqldb-dependency]
* Jettison - [Apache 2.0 license][jettison-dependency]
* log4j - [Apache 2.0 license][log4j-dependency]
* Maven - [Apache 2.0 license][maven-dependency]
* slf4j - [identical to MIT License][slf4j-dependency]
* Spring Batch - [Apache 2.0 license][spring-batch-dependency]
* Spring Framework - all licensed under [Apache 2.0][spring-framework-dependency]
* xpp3 - XMLPullParser - [Public Domain][xpp3-dependency]
* xstream - [BSD][xstream-dependency]
#### Problematic Dependencies
* JUnit - [Common Public License - v 1.0][junit-dependency] (look for license.txt in the github repository)
* just do not distribute your project with junit, should be easy
* Truezip - [Eclipse Public License, Version 1.0][truezip-dependency]
* if you distribute a project with truezip you need to include the license and a statement basically saying you did not change anything
* if you change the source, ... well if you run a commercial product you are screwed :-)
[hsqldb-in-memory]: http://hsqldb.org/doc/2.0/guide/running-chapt.html#running_inprocess-sect
[jdbc-init-db]: http://static.springsource.org/spring/docs/current/spring-framework-reference/html/jdbc.html#d0e24263
[JobLauncherTestUtils]: http://static.springsource.org/spring-batch/apidocs/org/springframework/batch/test/JobLauncherTestUtils.html
[maven-enforcer-plugin]: http://maven.apache.org/enforcer/maven-enforcer-plugin/
[maven-compiler-plugin]:http://maven.apache.org/plugins/maven-compiler-plugin/
[maven-resources-plugin]:http://maven.apache.org/plugins/maven-resources-plugin/
[standard-dir-layout]: http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html
[maven-surefire-plugin]:http://maven.apache.org/plugins/maven-surefire-plugin/
[project-aggregation]:http://maven.apache.org/guides/introduction/introduction-to-the-pom.html#Project_Aggregation
[aop-dependency]: http://aopalliance.sourceforge.net/
[bcprov-dependency]: http://www.bouncycastle.org/licence.html
[hamcrest-dependency]: https://github.com/hamcrest/JavaHamcrest
[hsqldb-dependency]: http://hsqldb.org/web/hsqlLicense.html
[jettison-dependency]: http://jettison.codehaus.org/License
[junit-dependency]: https://github.com/junit-team/junit
[log4j-dependency]: http://logging.apache.org/log4j/1.2/license.html
[maven-dependency]: http://maven.apache.org/license.html
[slf4j-dependency]: http://www.slf4j.org/license.html
[spring-batch-dependency]: http://static.springsource.org/spring-batch/license.html
[spring-framework-dependency]: http://www.springsource.org/about
[truezip-dependency]: http://truezip.java.net/license.html
[xpp3-dependency]: http://www.xmlpull.org/
[xstream-dependency]: http://xstream.codehaus.org/license.html
[git-update-submodules]: http://stackoverflow.com/a/9103113/62201
[apache-license]: http://www.apache.org/licenses/LICENSE-2.0.html
[database]:http://hsqldb.org/doc/2.0/guide/running-chapt.html#running_inprocess-sect
[git-submodules]: http://git-scm.com/book/de/Git-Tools-Submodules
[java-x-options]: http://docs.oracle.com/cd/E13150_01/jrockit_jvm/jrockit/jrdocs/refman/optionX.html
[listeners]: http://static.springsource.org/spring-batch/reference/html/configureStep.html#interceptingStepExecution
[maprepo-threadsafe]: https://jira.springsource.org/browse/BATCH-1541
[readers]: http://static.springsource.org/spring-batch/reference/html/domain.html#domainItemReader
[reuseForks]: http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#reuseForks
[forkCount]: http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#forkCount
[sourcetree]: http://sourcetreeapp.com/
[writers]: http://static.springsource.org/spring-batch/reference/html/domain.html#domainItemWriter
| 0 |
skprasadu/spring-security-examples | spring-security-examples | null | Spring Security
===============
[Spring Test MVC](https://github.com/SpringSource/spring-test-mvc) is a good framework for testing Spring MVC application.
In this sample, we demonstrated a simple Calendar application, where a regular user can create a Event and can see others event but cannot modify them. Admin user can modify other user's event as well.
We will demonstrate the Spring Security capability for Inmemory authorization provider, JDBC authorization provider, LDAP authorization provider, CAS Single sign on authorization provider.
Refer to this [blog](http://krishnasblog.com/2013/02/10/spring-test-mvc-junit-testing-spring-security-layer-with-inmemorydaoimpl-2/) for more details.
| 0 |
YogenRaii/spring-examples | Starter projects with Spring using Java and Kotlin. Contains modules that covers Security with JWT, Spring with Kotlin, Dependency injection simplified etc. | custom-bean-validation dependency-injection jwt-authentication kotlin spring-mvc spring-security | # spring-examples
Consists of examples that I've done in spring.
| 0 |
hibernate/hibernate-test-case-templates | Templates and examples to report issues to Hibernate | null | # Hibernate Test Case Templates
When creating a bug report for any project within the Hibernate family, it's extremely helpful (and, frankly, required)
to have an adequate test case available. This is obviously important to make reproducing the issue as easy as
possible. But it's also vital longer-term. Nearly every bug fix should include a regression test, which frequently is based
on the original reproducer (sometimes, it's the reproducer, verbatim).
To help create useful test cases, we're opening up this repo with various templates. Please see the READMEs in each
project's subdir for more info.
As always, this is open source for a reason! If these templates can be improved in any way, please let us know (either
through our JIRA instance or through GitHub Issues). Better yet, send us a pull request! | 0 |
itext/itext-publications-examples-java | null | null | null | 0 |
jveverka/spring-examples | Java 17 and Spring-Boot examples and demo projects. | arm64 docker java java-11 java-17 reactive-programming spring spring-boot spring-data spring-security springframework testcontainers testcontainers-junit-jupiter webflux x86-64 | [](https://opensource.org/licenses/Apache-2.0)
[](https://img.shields.io/badge/java-17-blue)
[](https://img.shields.io/badge/gradle-v7.3-blue)

# Spring-Boot examples
This project contains various simple or not-so simple [Spring Boot](https://spring.io/projects/spring-boot) examples.
### Environment setup
Minimal requirements: Please make sure following software is installed on your PC.
* [OpenJDK 17](https://adoptium.net/releases.html?variant=openjdk17&jvmVariant=hotspot)
* [Gradle 7.5](https://gradle.org/install/) or later
Please check [full system requirements](docs/system-requirements.md) for more details.
### Compile and Run
```
gradle clean build test
gradle --build-file spring-api-first/build.gradle clean openApiGenerate build test
```
### Examples
* [__spring native__](spring-native) - Spring native & AOT demo.
* [__spring data__](spring-data) - JPA / Hibernate / spring data and Flyway demo.
* [__spring websocket__](spring-websockets) - simple websocket demo.
* [__spring demo__](spring-demo) - basic springboot application, actuator, buildinfo, swagger.
* [__spring proxy__](spring-proxy) - simple springboot http proxy demo.
* [__spring API first__](spring-api-first) - OpenAPI 3.0 API first application design.
* [__spring webflux__](spring-webflux) - Spring Webflux example.
* [__spring dependency injection__](spring-di) - simple dependency injection demo.
* [__spring jcasbin__](spring-jcasbin) - simple integration example of jcasbin in spring app.
* [__spring security__](spring-security) - cookie session tracking and web security.
* [__spring security-jwt__](spring-security-jwt) - JWT based web security.
* [__spring fileserver__](spring-fileserver) - simple file server ove REST APIs
* [__spring_mockwebserver__](spring-mockwebserver) - simple http proxy service calling another service.
* [__spring bank__](spring-bank) - simple transactional web application.
* [__spring_mongo__](spring-mongo) - simple springboot + mongodb with testcontainers example.
### Topics
* [__Spring Native__](https://docs.spring.io/spring-native/docs/current/reference/htmlsingle/) - [Spring native case study.](spring-native)
* [__Reactive Spring__](https://docs.spring.io/spring-framework/docs/current/reference/html/web-reactive.html) - [Reactive Spring case study.](spring-webflux)
* [__JUnit5__](https://github.com/junit-team/junit5/) - [all projects]()
* __Security__ - [__spring security__](spring-security), [__spring jcasbin__](spring-jcasbin), [__spring security-jwt__](spring-security-jwt), [__spring-webflux__](spring-webflux)
* __Web/Http__ - [__spring proxy__](spring-proxy), [__spring fileserver__](spring-fileserver), [__spring websocket__](spring-websockets), [__spring API first__](spring-api-first), [__spring-webflux__](spring-webflux)
* [__Spring Data__](https://spring.io/projects/spring-data) - [__spring data__](spring-data), [__spring bank__](spring-bank)
* __Integrations__ - [__spring proxy__](spring-proxy), [__spring API first__](spring-api-first)
_Enjoy !_
| 0 |
mikailsheikh/cogitolearning-examples | All the examples for the tutorials on the Cogito Learning website. | null | cogitolearning-examples
=======================
All the examples for the tutorials on the Cogito Learning website.
| 0 |
andreaiacono/MapReduce | MapReduce by examples | mapreduce tutorial | MapReduce
=========
Sample code of MapReduce talk for JUG Milano, available at https://www.slideshare.net/andreaiacono/mapreduce-by-examples
It contains the code for:
* a basic [WordCount](https://github.com/andreaiacono/MapReduce/tree/master/src/main/java/samples/wordcount) example
* finding the [top-n used words in a text file with combiner](https://github.com/andreaiacono/MapReduce/tree/master/src/main/java/samples/topn)
* finding the [top-n used words in a text file with optimization](https://github.com/andreaiacono/MapReduce/tree/master/src/main/java/samples/topn_enhanced)
* [Computing the mean](https://github.com/andreaiacono/MapReduce/tree/master/src/main/java/samples/mean) of a set of numbers
* [Executing a join](https://github.com/andreaiacono/MapReduce/tree/master/src/main/java/samples/join) between two data files
* executing [K-means](https://github.com/andreaiacono/MapReduce/tree/master/src/main/java/samples/kmeans) clustering on a dataset
| 0 |
jboss-openshift/openshift-examples | null | null | # openshift-examples
| 0 |
aws-samples/amazon-kinesis-data-analytics-examples | Example applications in Java, Python and SQL for Kinesis Data Analytics, demonstrating sources, sinks, and operators. | null | ## Amazon Managed Service for Apache Flink examples
--------
> #### 🚨 August 30, 2023: Amazon Kinesis Data Analytics has been renamed to [Amazon Managed Service for Apache Flink](https://aws.amazon.com/managed-service-apache-flink).
--------
Example applications in Java, Python and SQL for Kinesis Data Analytics, demonstrating sources, sinks, and operators.
> #### ⚠️ We are updating and reorganising the Amazon Managed Service for Apache Flink code examples. <br/> Please, refer to the new repository [aws-samples/amazon-managed-service-for-apache-flink-examples](https://github.com/aws-samples/amazon-managed-service-for-apache-flink-examples/) with updated examples.
## License Summary
This sample code is made available under the MIT-0 license. See the LICENSE file.
| 1 |
mploed/ddd-with-spring | Code examples for my conference talk on implementing ddd with spring | domain-driven-design spring-boot springframework | # ddd-with-spring
<div align="center">
[](https://travis-ci.org/mploed/ddd-with-spring)
</div>
This repository aims at showcasing a way how you could implement various aspects from Domain-driven Design with the
Spring ecosystem. It is also the demo project for my conference talk "Implementing Domain-driven Design with the Spring
ecosystem".
## Which DDD aspects are covered?
The focus of the demo project are Aggregates, event-based communication and bounded contexts. The complete list is:
- Aggregates
- Event-based communication with
- a message broker (RabbitMQ)
- HTTP Feeds
- Spring Application Events
- Architectural styles
- Hexagonal Architecture
- CRUD
- Query-driven (not yet implemented properly)
## Which Spring Technologies are being used?
The project uses the following Spring technologies:
- Spring Framework Core
- Spring MVC
- Spring Boot
- Spring Cloud Stream
- Spring Data JPA
## Prerequisites and getting started
In order to run the application you need to have Docker and docker-compose installed on your machine.
When you have docker up and running you need to perform the following steps on the command line:
1. ./mvnw clean package
2. docker-compose up --build
3. After everything has started you can open http://localhost:8080 in a browser of your choice
| 0 |
prowide/prowide-core-examples | Source code examples for Prowide Core" | open source SWIFT Java library" | # prowide-core-examples
Requirements
============
* Java 11+
## Source code examples for "Prowide Core" open source SWIFT Java library.
The examples are provided as simple main classes to clarified API frequently asked questions.
Comprehensive test cases can be found in the actual https://github.com/prowide/prowide-core project
For additional resources and documentation please check: http://dev.prowidesoftware.com/
run "./gradlew eclipse" or "./gradlew idea" to generate your local IDE setup
Then use your IDE run option on any example class to see its output
**Important Note on Library Versions**
Prowide regularly releases new versions of its libraries. As such, the versions of the libraries you use may need to be updated over time.
To check the latest versions and relevant changes, please visit the [Prowide Release Notes](https://dev.prowidesoftware.com/SRU2023-10/release-notes/changelog-consolidated/). It is recommended to regularly review this page and update your project's library versions accordingly to ensure compatibility and access to the latest features and fixes.
### Issues
For Prowide Core API issues please use https://github.com/prowide/prowide-core/issues
| 0 |
eazybytes/microservices-with-spring | Microservices With Spring, Docker, Kubernetes - Code Examples | docker docker-compose java kubernetes microservices spring spring-boot spring-cloud | # Master Microservices with Java, Spring, Docker, Kubernetes
[](https://www.udemy.com/course/master-microservices-with-spring-docker-kubernetes/?referralCode=9365DB9B7EE637F629A9)
Learn how to create enterprise and production ready Microservices with Spring, Spring Cloud, Docker and Kubernetes.
## Topics covered in the course
* Section 1 - Introduction to Microservices Architecture
* Section 2 - Microservices & Spring Cloud (Match Made in Heaven)
* Section 3 - How do we right size our Microservices & Identifying boundaries(Challenge 1)
* Section 4 - Getting started with creation of accounts, loans & cards microservices
* Section 5 - How do we build, deploy, scale our microservices using Docker (Challenge 2)
* Section 6 - Introduction to Cloud Native Apps & 12factors
* Section 7 - Configurations Management in Microservices (Challenge 3)
* Section 8 - Service Discovery & Registration(Challenge 4)
* Section 9 - Making Microservices Resilient (Challenge 5)
* Section 10 - Handling Routing & Cross cutting concerns (Challenge 6)
* Section 11 - Distributed tracing & Log aggregation (Challenge 7)
* Section 12 - Monitoring Microservices Metrics & Health (Challenge 8)
* Section 13 - Automatic self-heal, autoscale, deployments (Challenge 9)
* Section 14 - Deploying all microservices into K8s cluster
* Section 15 - Deep Dive on Helm
* Section 16 - Securing Microservices using K8s Service
* Section 17 - Securing Microservices using OAuth2 client credentials grant flow
* Section 18 - Securing Microservices using OAuth2 Authorization code grant flow
* Section 19 - Introduction to K8s Ingress & Service Mesh (Istio)
## Pre-requisite for the course
- Good understanding on Java and Spring concepts
- Basic understanding on SpringBoot & REST services is a bonus but not mandatory
- Interest to learn and explore about Microservices
# Important Links
- Spring Cloud Project - https://spring.io/projects/spring-cloud
- Spring Cloud Config - https://spring.io/projects/spring-cloud-config
- Spring Cloud Gateway - https://spring.io/projects/spring-cloud-gateway
- Spring Cloud Netflix - https://spring.io/projects/spring-cloud-netflix
- Spring Cloud Sleuth - https://spring.io/projects/spring-cloud-sleuth
- The 12-factor App - https://12factor.net/
- Docker - https://www.docker.com/
- DockerHub - https://hub.docker.com/u/eazybytes
- Cloud Native Buildpacks - https://buildpacks.io/
- Resilience4j - https://resilience4j.readme.io/docs/getting-started
- Zipkin - https://zipkin.io/
- RabbitMQ - https://www.rabbitmq.com/
- Micrometer - https://micrometer.io/
- Prometheus - https://prometheus.io/
- Grafana - https://grafana.com/
- Kubernetes - https://kubernetes.io/
- GCP - https://console.cloud.google.com/
- GConsole - https://cloud.google.com/sdk
- Helm - https://helm.sh/
- Keycloak - https://www.keycloak.org/
- Istio - https://istio.io/
## Maven Commands used in the course
| Maven Command | Description |
| ------------- | ------------- |
| "mvn clean install -Dmaven.test.skip=true" | To generate a jar inside target folder |
| "mvn spring-boot:run" | To start a springboot maven project |
| "mvn spring-boot:build-image -Dmaven.test.skip=true" | To generate a docker image using Buildpacks. No need of Dockerfile |
## Docker Commands used in the course
| Docker Command | Description |
| ------------- | ------------- |
| "docker build . -t eazybytes/accounts" | To generate a docker image based on a Dockerfile |
| "docker run -p 8081:8080 eazybytes/accounts" | To start a docker container based on a given image |
| "docker images" | To list all the docker images present in the Docker server |
| "docker image inspect image-id" | To display detailed image information for a given image id |
| "docker image rm image-id" | To remove one or more images for a given image ids |
| "docker image push docker.io/eazybytes/accounts" | To push an image or a repository to a registry |
| "docker image pull docker.io/eazybytes/accounts" | To pull an image or a repository from a registry |
| "docker ps" | To show all running containers |
| "docker ps -a" | To show all containers including running and stopped |
| "docker container start container-id" | To start one or more stopped containers |
| "docker container pause container-id" | To pause all processes within one or more containers |
| "docker container unpause container-id" | To unpause all processes within one or more containers |
| "docker container stop container-id" | To stop one or more running containers |
| "docker container kill container-id" | To kill one or more running containers instantly |
| "docker container restart container-id" | To restart one or more containers |
| "docker container inspect container-id" | To inspect all the details for a given container id |
| "docker container logs container-id" | To fetch the logs of a given container id |
| "docker container logs -f container-id" | To follow log output of a given container id |
| "docker container rm container-id" | To remove one or more containers based on container ids |
| "docker container prune" | To remove all stopped containers |
| "docker compose up" | To create and start containers based on given docker compose file |
| "docker compose stop" | To stop services |
## Kubernetes Commands used in the course
| Kubernetes Command | Description |
| ------------- | ------------- |
| "kubectl apply -f filename" | To create a deployment/service/configmap based on a given YAML file |
| "kubectl get all" | To get all the components inside your cluster |
| "kubectl get pods" | To get all the pods details inside your cluster |
| "kubectl get pod pod-id" | To get the details of a given pod id |
| "kubectl describe pod pod-id" | To get more details of a given pod id |
| "kubectl delete pod pod-id" | To delete a given pod from cluster |
| "kubectl get services" | To get all the services details inside your cluster |
| "kubectl get service service-id" | To get the details of a given service id |
| "kubectl describe service service-id" | To get more details of a given service id |
| "kubectl get nodes" | To get all the node details inside your cluster |
| "kubectl get node node-id" | To get the details of a given node |
| "kubectl get replicasets" | To get all the replica sets details inside your cluster |
| "kubectl get replicaset replicaset-id" | To get the details of a given replicaset |
| "kubectl get deployments" | To get all the deployments details inside your cluster |
| "kubectl get deployment deployment-id" | To get the details of a given deployment |
| "kubectl get configmaps" | To get all the configmap details inside your cluster |
| "kubectl get configmap configmap-id" | To get the details of a given configmap |
| "kubectl get events --sort-by=.metadata.creationTimestamp" | To get all the events occured inside your cluster |
| "kubectl scale deployment accounts-deployment --replicas=3" | To increase the number of replicas for a deployment inside your cluster |
| "kubectl set image deployment accounts-deployment accounts=eazybytes/accounts:k8s" | To set a new image for a deployment inside your cluster |
| "kubectl rollout history deployment accounts-deployment" | To know the rollout history for a deployment inside your cluster |
| "kubectl rollout undo deployment accounts-deployment --to-revision=1" | To rollback to a given revision for a deployment inside your cluster |
| "kubectl autoscale deployment accounts-deployment --min=3 --max=10 --cpu-percent=70" | To create automatic scaling using HPA for a deployment inside your cluster |
| "kubectl logs node-id" | To get a logs of a given node inside your cluster |
## Helm Commands used in the course
| Helm Command | Description |
| ------------- | ------------- |
| "helm create [NAME]" | Create a default chart with the given name |
| "helm dependencies build" | To recompile the given helm chart |
| "helm install [NAME] [CHART]" | Install the given helm chart into K8s cluster |
| "helm upgrade [NAME] [CHART]" | Upgrades a specified release to a new version of a chart |
| "helm history [NAME]" | Display historical revisions for a given release |
| "helm rollback [NAME] [REVISION]" | Roll back a release to a previous revision |
| "helm uninstall [NAME]" | Uninstall all of the resources associated with a given release |
| "helm template [NAME] [CHART]" | Render chart templates locally along with the values |
| "helm list" | Lists all of the helm releases inside a K8s cluster |
| 0 |
mkyong/spring-embedded-database | Spring Embedded Database Examples | null | Spring Embedded Database
===============================
Template for a Spring 4 MVC + Embedded Database examples, using HSQLDB, H2 and Derby.
###1. Technologies used
* Maven 3.0
* Spring 4.1.6.RELEASE
* HSQLDB 2.3.2
* H2 1.4.187
* Derby 10.11.1.1
###2. To Run this project locally
```shell
$ git clone https://github.com/mkyong/spring-embedded-database
$ mvn jetty:run
```
Access ```http://localhost:8080/spring-mvc-db/```
###3. To import this project into Eclipse IDE
1. ```$ mvn eclipse:eclipse```
2. Import into Eclipse via **existing projects into workspace** option.
3. Done.
###4. Project Demo
Please refer to this article [Spring Embedded Database examples](http://www.mkyong.com/spring/spring-embedded-database-examples/)
| 0 |
heervisscher/htl-examples | AEM HTL examples | null | # htl-examples
### AEM compatibility
The package is only compatible with AEM6.4 SP2 and later.
It uses OSGi r7 annotations and HTL 1.4 syntax.
Uses aem core components: https://github.com/adobe/aem-core-wcm-components/
aem acs commoms: https://github.com/Adobe-Consulting-Services/acs-aem-commons/
## Included examples
### [OSGi R7](/core/src/main/java/com/adobe/examples/htl/core/service/impl/MySimpleServiceImpl.java)
Example use of OSGi r7 annotations
### [HTL 1.4](/ui.apps/src/main/content/jcr_root/apps/aemhtlexamples/components/htl1_4/htl1_4.html)
Some example usages of HTL 1.4 syntax
### [CustomBindingProvider](/core/src/main/java/com/adobe/examples/htl/core/bindings/CustomBindingProvider.java)
Provides an example of a CustomBindingProvider, this if you want generic objects available in HTL
### [HashMapExample](/core/src/main/java/com/adobe/examples/htl/core/hashmap/HashMapExample.java)
Example on using a Map<> together with HTL
### [LinkedList](/core/src/main/java/com/adobe/examples/htl/core/linkedlist/MiniNav.java)
Code sample on using a LinkedList with HTL
### [Exporter](/core/src/main/java/com/adobe/examples/htl/core/models/PageExporterImpl.java)
Example on using Exporter-annotation with Sling-Models
### [Request parameter](/ui.apps/src/main/content/jcr_root/apps/aemhtlexamples/samplecode/request-parameter.html)
How to get a request parameter in HTL
### [htl-maven-plugin](/ui.apps/pom.xml#L98-L99)
Validating HTL-files during build process
### [AutoCloseable](/core/src/main/java/com/adobe/examples/htl/core/service/AutoCloseableService.java)
Example on using AutoCloseable functionality, no need to close ResourceResolvers in code
### [Date-formatting](/ui.apps/src/main/content/jcr_root/apps/aemhtlexamples/components/aem6.3/formatting/formatting.html)
Formatting your date-objects in HTL
### [Number-formatting](/ui.apps/src/main/content/jcr_root/apps/aemhtlexamples/components/aem6.3/formatting/formatting.html)
Formatting numbers in HTL
### [Resource resolution in data-sly-use](/ui.apps/src/main/content/jcr_root/apps/aemhtlexamples/components/aem6.3/button/button.html)
Example that shows the resolution of resources directly in HTL
### [RequestAttributes](/ui.apps/src/main/content/jcr_root/apps/aemhtlexamples/components/aem6.3/product/product.html)
Passing in request-attributes to data-sly-resource and data-sly-include
### [OSGi annotations](/core/src/main/java/com/adobe/examples/htl/core/service/impl/MySimpleServiceImpl.java)
Example of the OSGi annotations, easy way to define OSGi properties.
Properties defined in [MyServiceConfiguration.java](/core/src/main/java/com/adobe/examples/htl/core/service/impl/MyServiceConfiguration.java), default config [here](/ui.apps/src/main/content/jcr_root/apps/aemhtlexamples/config/com.adobe.examples.htl.core.service.impl.MySimpleServiceImpl.xml)
### [Java8 Iterator](/core/src/main/java/com/adobe/examples/htl/core/java8iterator/Java8Iterator.java)
Use of a lambda expression that is supported in Java8
### [Custom Sling-Model for the Title-component](/core/src/main/java/com/adobe/examples/htl/core/models/TitleImpl.java)
Example of a custom Sling-Model implementation, that is picked up from the core components.
### [CompositeValueMap](/core/src/main/java/com/adobe/examples/htl/core/models/CompositeValueMapModel.java)
Example of using the CompositeValueMap to merge properties of two ValueMaps
### [HealthCheck](/core/src/main/java/com/adobe/examples/htl/core/hc/HealthCheckExample.java)
Example of a basic healthcheck, that can be executed from the OSGi-console
### [HealthCheck card example](/ui.apps/src/main/content/jcr_root/apps/settings/granite/operations/hc/.content.xml)
Shows how to display a healthcheck card in the operations dashboard. To extend the default collection of healthchecks you need to use sling:configCollectionInherit on the /apps/settings/granite/operations/hc node
### [Custom Polling](/core/src/main/java/com/adobe/examples/htl/core/polling/CustomPolling.java)
Example of a custom poller that gets executed based on the information in the cq:PollConfig node.
### [Datalayer mover](/core/src/main/java/com/adobe/examples/htl/core/datalayer/DatalayerFilter.java)
Common problem when defining a datalayer is that the JS-fragments are in the body,
while some of those need to be in the head. This filter is moving JS-fragments from the body into the head.
### [Flexible adapters](/ui.apps/src/main/content/jcr_root/apps/aemhtlexamples/components/aem6.3/flexibleadaptable/example.html)
Shows how to have a flexible way of using adapters, instead of always the same resource. Available since 6.3.1.1
| 0 |
Clever-Wang/spring-boot-examples | springboot整合Shiro系列 | null | null | 0 |
arafalov/solr-indexing-book | Example code for the book Indexing Data in Apache Solr"" | examples solr | Apache Solr for Indexing Data (Instant How-to)
==================
<div style="float: left">
<img src="https://github.com/arafalov/solr-indexing-book/raw/master/solr_book.jpg"/>
</div>
This repository contains examples and extra material for the book [Instant Apache Solr for Indexing Data How-to](https://subscription.packtpub.com/book/big_data_and_business_intelligence/9781782164845/1) by Alexandre Rafalovitch. The directory **published** contains the support files and collections as described in the book.
| 1 |
cloudbees/cloudbees-examples | Public repository - Examples for documentation | null | # Welcome
Welcome to the CloudBees examples repository. This repository is a place for storing tutorials, examples, and other learning materials to complement mentions in product documentation.
Of note:
* It is owned and managed by the docs team.
* This repo contains assets that complement mentions in product documentation. As such, it is not standalone.
* It is pre-populated with top-level product folders. Organize content in sub-folders appropriate to your files or projects.
## Managing asset links
* When providing a link in product documentation to a repo asset, consider using the raw link where appropriate. This gives the reader a cut/paste-ready version of the asset.
* Choose prudent filenames to minimize future renames. Simply moving a file to a new name breaks exiting links out in the wild. It is recommended to leverage symbolic links to effect "redirects". The following shows how to rename `origfile.yaml` and then create a hard link to this original name. As a result, links to the old name will automatically "redirect" to the new name.
```shell
// move old file to new name
git mv origfile.yaml newfile.yaml
git commit -m "commit message"
git push
// create link to old file
ln newfile.yaml origfile.yaml
// add, commit, and push the symlink
git add origfile.yaml
git commit -m "created symlink to the original file"
git push
```
## In this repo
The following table is a brief summary of each of the example projects.
|Directory|Description |
|:---|:---|
|cloudbees-build-test-automation|Example files referenced by CloudBees Build and Test Automation documentation.|
|cloudbees-cd|Example files referenced by CloudBees CD documentation.|
|cloudbees-ci|Example files referenced by CloudBees CI documentation.|
|cloudbees-feature-flags|Example files referenced by CloudBees Feature Flags documentation.|
|cloudbees-sdm|Example files for CloudBees SDM.|
|pipeline-template-examples|This repository includes a sample Pipeline Template Catalog. The demos folder includes examples of how to customize a template.yaml file.|
|helm-custom-value-file-examples|Custom Property Value Files for the CloudBees Core for Modern Platforms Helm installation.|
|flow-on-kubernetes|Sample property value files for CloudBees Flow on Kubernetes Helm installation.|
| 0 |
grundid/nfctools-examples | Examples for the nfctools library | null | null | 0 |
eclipse-ee4j/jakartaee-examples | Jakarta EE Examples | null | # Jakarta EE 10 Examples
This repository contains code examples for Jakarta EE 10.
A selection of these examples have an elaborate explanation in the Jakarta EE Tutorial. The tutorial content is located in the
https://github.com/jakartaee/jakartaee-tutorial/ repository.
Note that this project, as the tutorial, is currently very much a work in progress.
### Types of examples
We use various different types of examples, as detailed below.
### Focused
[Focused](focused/README.md) examples demonstrate a single Jakarta technology and/or a single Jakarta API in a coherent and consistent way.
Such focused examples are a little like an [SSCCE](http://sscce.org) (Short, Self Contained, Correct Example),
but with a slightly different goal. Where the main purpose of an SSCCE is to be able to reproduce a bug, the purpose
of the focused example is to demonstrate a technology.
Each focused example is its own Maven module, and (typically) its own war. Such war can be deployed standalone to a server of choice, where it can be manually run, debugged, modified, etc.
To assure focused examples actually work, and as implicit documentation of how the example is run (what requests need to be done), most examples are accompanied by a test (in the future all examples should have a test). All tests follow the same pattern:
* A server/runtime is started (if needed)
* The actually build output of the Maven module (typically a war) is deployed to said server/runtime
* The test, which runs on the client, issues HTTP requests to the server/runtime
* The test assures the response of the server/runtime is expected
* The application is undeployed
* The server/runtime is stopped (if needed)
Focused examples use Maven for building and starting the tests and JUnit for defining and executing the tests. Arquillian is used, but only to start/stop a server, and to deploy/undeploy the test application for a given server/runtime.
### Tutorial
[Tutorial](tutorial/README.md) examples are examples that happen to be used in the current version of the tutorial. They are a mix of focused examples, and more elaborate examples. They are currently specifically a work in progress and may be moved to various other locations within this repo.
### Eleborate (future)
Eleborate examples are more complex and demonstrate multiple technologies and APIs to work together towards some practical goal.
### Applications (future)
Actual applications that are an example of how to use Jakarta EE for a specific sector, industry, or type of application. E.g. an example application for a pet store, a cargo tracker, etc.
See [Java EE Kickoff](https://github.com/javaeekickoff) for an idea of what example applications could be included here.
| 0 |
aterai/java-swing-tips | Java Swing example. | java swing | java-swing-tips
===============
[日本語](https://ateraimemo.com/Swing.html): `Java Swing`の`GUI`プログラムを、 **小さなソースコード付きサンプル** を使って紹介しています。
[English](https://java-swing-tips.blogspot.com/): Introduce the `GUI` program of `Java Swing` using **small source code examples**.
<img src="https://lh3.ggpht.com/_9Z4BYR88imo/TQslJy3MxYI/AAAAAAAAAts/xrxOCvbp-0A/s800/screenshots.png" />
Swingとは
---------------
[About the JFC and Swing (The Java™ Tutorials)][0]
`Swing`は、`GUI`(グラフィカル・ユーザ・インタフェース)を作成するための、`Java`標準のコンポーネントセット(ライブラリ、`UI`ツールキット)です。
Licence
---------------
- ソースコードはMITライセンスで公開しています。
- https://github.com/aterai/java-swing-tips/blob/master/LICENSE.txt
編集方針
---------------
- **最も欲しいものはサンプル** [あるチュートリアルの思い出 - Backnumbers: Steps to Phantasien][1]
- **`SSCCE`** [Short, Self Contained, Correct Example][2]
- **`MCVE`** [How to create a Minimal, Complete, and Verifiable example - Help Center - Stack Overflow][3]
[0]: https://docs.oracle.com/javase/tutorial/uiswing/start/about.html
[1]: http://steps.dodgson.org/bn/2007/07/06/
[2]: http://sscce.org/
[3]: https://stackoverflow.com/help/mcve
| 0 |
erlieStar/rabbitmq-examples | rabbitmq各种用法示例 | null | # RabbitMQ入门教程
## 模块
rabbitmq-api:原生api的使用
springboot-rabbitmq-annotation: springboot整合rabbitmq注解版本
springboot-rabbitmq-javaconfig: springboot整合rabbitmq javaconfig版本
springboot-rabbitmq-ack: 消息可靠投递的demo
## 教程
[RabbitMQ系列教程一:消息中间件的诸侯征战史](https://github.com/erlieStar/rabbitmq-examples/blob/master/docs/RabbitMQ%E7%B3%BB%E5%88%97%E6%95%99%E7%A8%8B%E4%B8%80%EF%BC%9A%E6%B6%88%E6%81%AF%E4%B8%AD%E9%97%B4%E4%BB%B6%E7%9A%84%E8%AF%B8%E4%BE%AF%E5%BE%81%E6%88%98%E5%8F%B2.md)
[RabbitMQ系列教程二:RabbitMQ的安装及图形界面的使用](https://github.com/erlieStar/rabbitmq-examples/blob/master/docs/RabbitMQ%E7%B3%BB%E5%88%97%E6%95%99%E7%A8%8B%E4%BA%8C%EF%BC%9ARabbitMQ%E7%9A%84%E5%AE%89%E8%A3%85%E5%8F%8A%E5%9B%BE%E5%BD%A2%E7%95%8C%E9%9D%A2%E7%9A%84%E4%BD%BF%E7%94%A8.md)
[RabbitMQ系列教程三:RabbitMQ最全特性一览及Java Api的使用](https://github.com/erlieStar/rabbitmq-examples/blob/master/docs/RabbitMQ%E7%B3%BB%E5%88%97%E6%95%99%E7%A8%8B%E4%B8%89%EF%BC%9ARabbitMQ%E6%9C%80%E5%85%A8%E7%89%B9%E6%80%A7%E4%B8%80%E8%A7%88%E5%8F%8AJava%20Api%E7%9A%84%E4%BD%BF%E7%94%A8.md)
[RabbitMQ系列教程四:RabbitMQ整合Spring Boot](https://github.com/erlieStar/rabbitmq-examples/blob/master/docs/RabbitMQ%E7%B3%BB%E5%88%97%E6%95%99%E7%A8%8B%E5%9B%9B%EF%BC%9ARabbitMQ%E6%95%B4%E5%90%88Spring%20Boot.md)
[RabbitMQ系列教程五:RabbitMQ如何保证消息的可靠投递](https://github.com/erlieStar/rabbitmq-examples/blob/master/docs/RabbitMQ%E7%B3%BB%E5%88%97%E6%95%99%E7%A8%8B%E4%BA%94%EF%BC%9ARabbitMQ%E5%A6%82%E4%BD%95%E4%BF%9D%E8%AF%81%E6%B6%88%E6%81%AF%E7%9A%84%E5%8F%AF%E9%9D%A0%E6%8A%95%E9%80%92.md)
[RabbitMQ系列教程六:如何处理消费过程中的重复消息?](https://github.com/erlieStar/rabbitmq-examples/blob/master/docs/RabbitMQ%E7%B3%BB%E5%88%97%E6%95%99%E7%A8%8B%E5%85%AD%EF%BC%9A%E5%A6%82%E4%BD%95%E5%A4%84%E7%90%86%E6%B6%88%E8%B4%B9%E8%BF%87%E7%A8%8B%E4%B8%AD%E7%9A%84%E9%87%8D%E5%A4%8D%E6%B6%88%E6%81%AF.md)
## 注意
有人向小编反映,看教程时图片会裂,因此导出了一个pdf版本,放在docs目录下(小编常年开vpn,一次也没遇到过)
因为加了一个pdf文件,可能git clone命令有点慢,多等一下就行了
## 联系我
email: erlie139@gmail.com
欢迎大家和我交流,关注公众号**Java识堂**获取我的联系方式

| 0 |
kpbird/NotificationListenerService-Example | NotificationListenerService Example | null | NotificationListenerService-Example
===================================
##Introduction
NotificationListenerService is introduced in Android 4.3 (API 18). It allows an application to receive information about notifications as it creates or removes. NotificationListenerService class is derived from the Service class. It has two abstract methods namely 1. onNotificationPosted 2. onNotificationRemoved.
To use NotificationListenerService, we need to create a java file which extends NotificationListenerService and implement two callback methods. Both methods have a parameter named "sbn", which is an object of StatusBarNotification class. StatusBarNotification provides necessary information about Notifications.
NotificationListenerService provides facility to fetch active notifications using getActiveNotifications and also provides a feature to remove notifications using cancelAllNotifications.
##Useful Methods
1. NotificationListenerService
* onNotificationPosted
* onNotificationRemoved
2. StatusBarNotification
* getId
* getNotification
* getPackageName
* getPostTime
* isClearable
* isOngoing
##Note
User require to enable notification permission from "Settings > Security > Notification access".



 | 1 |
spdx/spdx-examples | Examples of SPDX files for software combinations | null | # SPDX Usage Examples
This repository includes demonstrations of [SPDX](https://spdx.dev) for various scenarios and use cases.
The repository is organized by profiles which represents a set of scenarios and use cases for a particular domain (e.g. security, license compliance).
Each directory contains a README.md file describing the profile and the examples contained within that directory.
The presentations directory contains examples included in various SPDX presentations.
Please note that this repository does not contain all of the supported fields nor all of the supported serialization formats in the latest version of the spec. Please see the [SPDX Specification Examples](https://github.com/spdx/spdx-spec/tree/development/v2.3.1/examples) for the latest and examples that contain all of the supported fields and formats.
## Licenses
Copyright Contributors to the spdx-examples project.
Unless otherwise specified, source code in this repository is licensed under the GNU General Public License, Version 3 or later (GPL-3.0-or-later). A copy is included in the COPYING file.
Other licenses may be specified as well for certain files for purposes of illustration or where third-party components are used.
Documentation in this repository is licensed under the Creative Commons Attribution 4.0 International license (CC-BY-4.0), available at https://creativecommons.org/licenses/by/4.0/.
SPDX documents in this repository are provided under CC0 1.0 Universal (CC0-1.0), available at https://creativecommons.org/publicdomain/zero/1.0/.
| 0 |
weld/core | Weld, including integrations for Servlet containers and Java SE, examples and documentation | null | Weld
====
[](https://gitter.im/weld/user)

[](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22weld-core-impl%22)
[](http://www.apache.org/licenses/LICENSE-2.0.html)
Weld is the reference implementation of CDI: Contexts and Dependency Injection for the Java EE Platform which is the Java standard for dependency injection and contextual lifecycle management and one of the most important and popular parts of the Java EE platform.
Weld is integrated into many Java EE application servers such as WildFly, JBoss Enterprise Application Platform, GlassFish, Oracle WebLogic and others. Weld can also be used in a Servlet-only environment (Tomcat, Jetty) or plain Java SE environment.
See http://weld.cdi-spec.org for more details.
Building Weld
-------------
To build Weld simply run
> $ mvn clean install
Upgrading Weld in WildFly
-------------------------
Firstly, set the `JBOSS_HOME` environment property to point to your WildFly installation which already contains Weld 3 in older version:
> $ export JBOSS_HOME=/opt/wildfly
Then, run the upgrade script:
> $ mvn package -Pupdate-jboss-as -f jboss-as/pom.xml -Dweld.update.version=${weld.version}
In the above snippet, `${weld.version}` is the version of Weld you want to use.
Now you should have patched WildFly in `JBOSS_HOME`.
Running integration tests and the TCK on WildFly
----------------------------------------------------
Follow the steps above to set the JBOSS_HOME environment property and to upgrade Weld
within WildFly. Then, run:
> $ mvn clean verify -Dincontainer -f tests-arquillian/pom.xml
> $ mvn clean verify -Dincontainer -f jboss-tck-runner/pom.xml
If you want to run a specific test you can use the `-Dtest=<test_name>` flag. For example
> $ mvn clean verify -Dincontainer -f jboss-tck-runner/pom.xml -Dtest=FireEventTest
Will run all the tests defined in `FireEventTest`.
> $ mvn clean verify -Dincontainer -f jboss-tck-runner/pom.xml -Dtest=FireEventTest#testInjectedEventAcceptsEventObject
Will only run the `FireEventTest.testInjectedEventAcceptsEventObject()` test method.
| 0 |
graphql-java/graphql-java-examples | null | null | null | 0 |
bbejeck/kafka-streams | Code examples for working with Kafka Streams | null | # kafka-streams
This is the repository for the examples of using Kafka streams covered in the blog posts:
* [Kafka Streams - The Processor API](http://codingjunkie.net/kafka-processor-part1/)
* [Kafka Streams - The KStreams API](http://codingjunkie.net/kafka-streams-part2/)
* [Machine Learning with Kafka Streams](http://codingjunkie.net/kafka-streams-machine-learning/)
## Requirements to build this project
1. Java 8
2. Gradle
## Requirements to run the examples
1. [kafka](https://github.com/apache/kafka) version kafka_2.11-0.10.1.0 see the section marked "Running a task on a particular version of Scala"
2. The [json-data-generator](https://github.com/acesinc/json-data-generator) from [ACES,Inc](http://acesinc.net/)
## Setup Instructions
#### Extact the kafka_2.11-0.10.1.0.tgz file ####
tar -xvzf kafka_2.11-0.10.1.0.tgz
#### Start zookeeper and kafka
```
kafka-install-dir/bin/zookeeper-server-start.sh kafka-install-dir/conf/zookeeper.properties
kafka-install-dir/bin/kafka-server-start.sh kafka-install-dir/conf/server.properties
```
#### Install the Json-Data-Generator
Download the latest [json-data-generator release](https://github.com/acesinc/json-data-generator/releases) and follow the install instructions [here](http://acesinc.net/introducing-a-streaming-json-data-generator/)
#### Setup the kafka-streams repo
Clone or fork the repo
```
git clone git@github.com:bbejeck/kafka-streams
cd kafka-streams
```
Then copy the json config files to json generator conf directory
```
cp streaming-workflows/* <dir>/json-data-generator-1.2.0/conf
```
Create all the topics required by the examples
```
./bin/create-topics.sh /usr/local/kafka_2.11-0.10.1.0 localhost 2181
args are kafka home, zookeeper host and zookeeper port adjust accordingly
```
### Running the Purchase Processor API KStreams API Examples ###
cd <dir>/json-data-generator-1.2.0/
java -jar json-data-generator-1.2.0 purchases-config.json
cd kafka-streams
./gradlew runPurchaseProcessor | runPurchaseStreams
### Running the Stock Trades Processor API or KStreams API Examples ###
cd <dir>/json-data-generator-1.2.0/
java -jar json-data-generator-1.2.0 stock-transactions-config.json
cd kafka-streams
./gradlew runStockProcessor | runStockStreams
### Running the Twitter KStreams Language Classification Example ###
rename src/main/resources/twitter-app.properties.template to twitter-app.properties
fill out the properties file with all the required values
cd kafka-streams
./gradlew runTwitterKstreamNLP
### Viewing the results of the purchase streaming examples ###
cd kafka_install-dir/bin
./kafka-console-consumer --topic [patterns|rewards|purchases] --zookeeper localhost:2181
### Viewing the results of the stock-trading streaming examples ###
cd kafka_install-dir/bin
./kafka-console-consumer --topic [stocks-out|transaction-summary] --zookeeper localhost:2181
### Viewing the results of the Twitter KStreams Language Classification Example ###
cd kafka_install-dir/bin
./kafka-console-consumer --topic [english|french|spanish] --zookeeper localhost:2181
| 0 |
newrelic/newrelic-opentelemetry-examples | Examples for sending OpenTelemetry sourced data to New Relic. | null | <a href="https://opensource.newrelic.com/oss-category/#example-code"><picture><source media="(prefers-color-scheme: dark)" srcset="https://github.com/newrelic/opensource-website/raw/main/src/images/categories/dark/Example_Code.png"><source media="(prefers-color-scheme: light)" srcset="https://github.com/newrelic/opensource-website/raw/main/src/images/categories/Example_Code.png"><img alt="New Relic Open Source example project banner." src="https://github.com/newrelic/opensource-website/raw/main/src/images/categories/Example_Code.png"></picture></a>
# New Relic OpenTelemetry Examples
This project contains examples illustrating usage of OpenTelemetry with New Relic. The examples aim to demonstrate the most common configurations we expect users to encounter, but isn't an exhaustive set of the ways you can use OpenTelemetry with New Relic. See [getting started guides](#getting-started-guides) and [other examples](#other-examples) for an index of available examples.
## Getting Started Guides
The [Getting Started Guides](./getting-started-guides/README.md) demonstrate how to get started with OpenTelemetry and New Relic. Each of the languages listed illustrates how to add OpenTelemetry instrumentation to a simple web application, and configure OpenTelemetry to export data to New Relic.
* .NET ([uninstrumented](./getting-started-guides/dotnet/Uninstrumented) / [instrumented](./getting-started-guides/dotnet/Instrumented))
* Go ([uninstrumented](./getting-started-guides/go/uninstrumented) / [instrumented](./getting-started-guides/go/instrumented))
* Java ([uninstrumented](./getting-started-guides/java/uninstrumented) / [instrumented](./getting-started-guides/java/instrumented))
* Javascript ([uninstrumented](./getting-started-guides/javascript/uninstrumented) / [instrumented](./getting-started-guides/javascript/instrumented))
* Python ([uninstrumented](./getting-started-guides/python/Uninstrumented) / [instrumented](./getting-started-guides/python/Instrumented))
* Ruby ([uninstrumented](./getting-started-guides/ruby/uninstrumented) / [instrumented](./getting-started-guides/ruby/instrumented))
## Other Examples
OpenTelemetry is a big ecosystem and everything doesn't fit into the goals of the [getting started guides](#getting-started-guides). These "other examples" demonstrate how other areas of OpenTelemetry fit in with New Relic.
* Collector
* [OpenTelemetry Collector with OTLP and New Relic](./other-examples/collector/nr-config)
* [OpenTelemetry Collector with Host Monitoring and New Relic](./other-examples/collector/host-monitoring)
* [OpenTelemetry Collector with Confluent Cloud and New Relic](./other-examples/collector/confluentcloud)
* [OpenTelemetry Collector with Singlstore and New Relic](./other-examples/collector/singlestore)
* [OpenTelemetry Collector with HCP Consul and New Relic](./other-examples/collector/hcp-consul)
* Java
* [OpenTelemetry Agent New Relic Config](./other-examples/java/agent-nr-config)
* [Micrometer Shim with OTLP Export](./other-examples/java/micrometer-shim)
* [Logs In Context with Log4j2 and Log Forwarding](./other-examples/java/logs-in-context-log4j2)
* .NET
* [OpenTelemetry Agent With New Relic Config](./other-examples/dotnet/agent-nr-config)
* Serverless
* AWS Lambda
* [OpenTelemetry Lambda .NET New Relic Config](./other-examples/serverless/aws-lambda/dotnet)
* [OpenTelemetry Lambda Java New Relic Config](./other-examples/serverless/aws-lambda/java)
* Azure Functions
* [OpenTelemetry Azure Functions Node New Relic Config](./other-examples/serverless/azure-functions/node/http-trigger-app)
## How To Use
1. Clone this repo.
2. Follow the directions in the README of the example that you are interested in.
## Contribute
We encourage your contributions to improve `newrelic-opentelemetry-examples`! Keep in mind that when you submit your pull request, you'll need to sign the CLA via the click-through using CLA-Assistant. You only have to sign the CLA one time per project.
Generally, we want to focus on the [getting started guides](#getting-started-guides). We're open to additional examples being added which are aligned with the [demo app specification](./getting-started-guides/demo-app-specification.md) and which have a volunteer [codeowner](#codeowners).
We're more selective about additions to [other examples](#other-examples). We use the following criteria to evaluate additions:
* Does the example demonstrate a very popular use case or recurring pain point?
* Has someone has volunteered to be a [codeowner](#codeowners)?
* Is there documentation - either in the readme or [docs.newrelic.com](https://docs.newrelic.com/) - which describes how to use the data produced by the example in New Relic?
* Is there continuous integration (i.e. [github action](.github/workflows/pull_request.yml)) ensuring that the example code functions?
If the answer is yes to all those questions, we'll likely accept the contribution.
If you have any questions, or to execute our corporate CLA (which is required if your contribution is on behalf of a company), drop us an email at opensource@newrelic.com.
### Codeowners
Codeowners for each example are defined in [codeowner](.github/CODEOWNERS). Each codeowner is responsible for:
* Keeping dependencies (relatively) up to date.
* Responding to issues related to the example.
Codeowners are added as collaborators individually and given "write" permissions to the repository.
Examples without a codeowner may be deleted.
## Vulnerabilities
As noted in our [security policy](https://github.com/newrelic/newrelic-opentelemetry-examples/security/policy), New Relic is committed to the privacy and security of our customers and their data. We believe that providing coordinated disclosure by security researchers and engaging with the security community are important means to achieve our security goals.
If you believe you have found a security vulnerability in this project or any of New Relic's products or websites, we welcome and greatly appreciate you reporting it to New Relic through [HackerOne](https://hackerone.com/newrelic).
If you would like to contribute to this project, review [these guidelines](./CONTRIBUTING.md).
To all contributors, we thank you! Without your contribution, this project would not be what it is today.
## License
`newrelic-opentelemetry-examples` is licensed under the [Apache 2.0](http://apache.org/licenses/LICENSE-2.0.txt) License.
`newrelic-opentelemetry-examples` also uses source code from third-party libraries. You can find full details on which libraries are used and the terms under which they are licensed in the third-party notices document.
| 0 |
howtoprogram/junit5-examples | JUnit 5 examples, tutorials | null | #JUnit 5 Examples
Contains all JUnit 5 Examples and Tutorial
Go to each sub project.
## 1. Import source code into Eclipse
### Maven
Menu **File –> Import –> Maven –> Existing Maven Projects**
Browse to your source code location
Click **Finish** button to finish the importing
### Gradle
Menu **File –> Import –> Gradle Project –> Select Project --> Next until finish**
## 2. Sub Modules
[JUnit 5 Assertions Example](http://howtoprogram.xyz/2016/08/12/junit-5-assertions-example/)
### junit5-assertions-examples
[JUnit 5 Disable or Ignore A Test](http://howtoprogram.xyz/2016/08/14/junit-5-disable-ignore-tests/)
### junit5-disable-test-example
[JUnit 5 Exception Testing](http://howtoprogram.xyz/2016/08/15/junit-5-exception-testing/)
### junit5-exception-testing-example
[JUnit 5 Test Suite ](http://howtoprogram.xyz/2016/08/16/junit-5-test-suite/)
### junit-5-test-suite-example
[JUnit 5 Assumptions With Assume](http://howtoprogram.xyz/2016/08/17/junit-5-assumptions-assume/)
### junit-5-assumptions
[JUnit 5 Nested Tests Examples](http://howtoprogram.xyz/2016/08/19/junit-5-nested-tests-examples/)
### junit5-nested-test-example
[JUnit 5 Dynamic Tests - Generate Tests at Run-time](http://howtoprogram.xyz/2016/08/21/junit-5-dynamic-tests/)
### junit5-dynamic-test-example
[JUnit 5 Maven Example](http://howtoprogram.xyz/2016/09/09/junit-5-maven-example/)
### junit5-maven-example
## 3. Related Posts
## [JUnit 5 Tutorial](http://howtoprogram.xyz/java-technologies/junit-5-tutorial/)
## [JUnit 5 vs JUnit 4](http://howtoprogram.xyz/2016/08/10/junit-5-vs-junit-4/)
## [JUnit 5 Basic Introduction](http://howtoprogram.xyz/2016/08/07/junit-5-basic-introduction/)
## [JUnit 5 and Spring Boot Example](https://howtoprogram.xyz/2017/09/12/junit-5-spring-boot-example/)
| 0 |
eclipse-ditto/ditto-examples | Eclipse Ditto™: Digital Twin framework - Examples | eclipse-ditto examples hacktoberfest java | # Eclipse Ditto :: Examples
[](https://gitter.im/eclipse/ditto?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
This repository contains examples and demonstrations of how to use [Eclipse Ditto](https://github.com/eclipse/ditto).
# Projects
## [grove control](grove-ctrl/)
The grove control project shows the different communication possibilities
using Eclipse Ditto on your local machine and a Rasperry Pi with GrovePi+ board
as IoT device. This project uses Python for the Raspberry Pi code and jQuery for the Web UI.
## [Rest to WebSocket demo](rest-to-websocket/)
This example shows how to combine the REST and WebSocket API of Eclipse Ditto.
This is demonstrated using a Frontend that sends REST requests and
a Thing that has a WebSocket connection to Ditto and uses it to receive
and respond to Messages. This project requires a running Eclipse Ditto
instance and a modern web browser.
## [Octopus via Hono to Ditto](octopus-via-hono/)
Arduino based example on a ESP8266 board publishing read out sensor values in Ditto Protocol via
the MQTT endpoint of [Eclipse Hono](https://www.eclipse.org/hono/) to a digital twin in Ditto:
- BME680 sensor
- temperature
- humidity
- barometer
- BNO055 sensor
- temperature
- linear acceleration
- angular velocity
- gravity
- absolute orientation
- accelerometer
- magnetometer
- power voltage
## [IoT-Device connected directly to Ditto via MQTT - controlled by a custom solution](mqtt-bidirectional/)
This example demonstrates how to connect an Arduino based device to Eclipse Ditto and how
payload mapping can be utilized to transform its telemetry data into a valid digital twin representation.
Furthermore a simple front-end allows manipulating the digital twin and receives twin updates
via SSE (Server Sent Events).
### Parts of this example
- Arduino
- How to establish a network connection
- How to establish a MQTT connection
- How to receive and publish valid JSON data
- Front-end
- How to use Ditto's HTTP API for
- Create policy and things
- Create a connection (MQTT)
- Send live messages to device
- Listen to server sent events
- Eclipse Ditto
- How to set up Eclipse Ditto with Docker (alternatively use Ditto's Sandbox)
- How to apply payload mapping on incoming messages from a connection
## [Quick introduction to MQTT in Ditto](mqtt-quick-introduction/)
This example demonstrates how to setup step by step MQTT connection in Ditto.
It presents how to updates things in Ditto and how to receive notifications that something was changed.
## [Samples for Microsoft Azure users](azure/)
Samples to leverage Eclipse Ditto capabilities with Microsoft Azure services.
## [kata](kata/)
A code kata is a way of learning new things and consolidating what has been learned. The presented katas serve to
understand specific features of ditto better.
| 0 |
nitinsurana/Struts2-Examples | Struts2 Examples | null | Struts2
=======
Struts2 Examples
| 0 |
apache/camel-k-examples | Apache Camel K Examples | camel integration java | # Camel K Examples
This repository contains a collection of Camel K examples useful to understand how it works, common use cases and the idiomatic programming model.
You can find more information about Apache Camel and Apache Camel K on the [official Camel website](https://camel.apache.org).
## Before you begin
### Open the examples in the IDE
To better work on all examples, make sure you have all them locally by checking out the git repository:
```
git clone git@github.com:apache/camel-k-examples.git
```
We suggest you to open the examples with [VSCode](https://code.visualstudio.com/) because it provides useful extensions for working with Camel K files.
If you've already installed it on your machine, after cloning the repository, you can open the examples on the IDE executing:
```
code camel-k-examples
```
We suggest you to install the following extensions for VSCode (The IDE should automatically prompt to ask you to install them):
- [Extension Pack for Apache Camel](https://marketplace.visualstudio.com/items?itemName=redhat.apache-camel-extension-pack): provides auto-completion, error handling as well as integrated IDE tools to manage the lifecycle of Camel K integrations
- [Didact](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-didact): Provides a better getting started experience when following readme files in the various examples
### Have your Kubernetes cluster ready
All examples require that you are connected to a Kubernetes/OpenShift cluster, even a local instance such as [Minikube](https://github.com/kubernetes/minikube) or [CRC](https://github.com/code-ready/crc). Some advanced examples may have additional requirements.
Ensure that you've followed the [Camel K installation guide](https://camel.apache.org/camel-k/latest/installation/installation.html) for your specific cluster before looking at the examples.
### Install the CLI tools
All examples need at least the following CLI tools installed on your system:
- `kubectl`: the Kubernetes default CLI tool that can be downloaded from the [Kubernetes releases page](https://github.com/kubernetes/kubernetes/releases).
- `kamel`: the Apache Camel K CLI that can be downloaded from the [Camel K release page](https://github.com/apache/camel-k/releases).
## Generic Examples
We are providing also a folder containing multiple generic examples in [Generic Examples](./generic-examples) folder.
## Kamelets
In the [Kamelets](./kamelets) folder, you'll get a set of examples based on Kamelets.
## Custom Examples
Examples are contained in directories ordered by level of difficulty.
Most examples provide a `readme.didact.md` file instead of the standard readme file. For those, if you're using VSCode with Didact installed, you can **right click on the `readme.didact.md` file and hit "Didact: Start Didact Tutorial from File"**.
This is the current list of examples:
- [01 Basic](./01-basic): Getting started with Camel K by learning the most important features that you should know before trying to develop more complex examples.
- [02 Serverless API](./02-serverless-api): Learn how to design an API that manages files in a remote storage location and leverages *Knative* Serving to scale automatically (even to zero instances) based on the current load.
- [03 Knative Source Basic](./03-knative-source-basic): Getting started with Knative Camel Source by learning the most important concepts you should know before trying to develop more complex examples.
- [04 AWS Kinesis Source Basic](./04-aws-kinesis-source-basic): Learn how to consume AWS Kinesis events using Knative Camel Source.
- [10 Knative Source Salesforce](./10-knative-source-salesforce): Learn how to create a Knative Camel Source for Salesforce.
- [11 Knative Source Slack](./11-knative-source-slack): Getting started with Slack integration using Knative Camel Source.
- [90 AWS Kinesis Source With a Custom Configuration](./90-aws-kinesis-customized-event-source): Learn how to use a custom AWS Kinesis configuration when consuming AWS Kinesis events using Knative Camel Source.
| 0 |
kevinsawicki/github-maven-example | Example project using GitHub Maven Plugins | java | This is an example project that uses the [GitHub Maven Plugins](https://github.com/github/maven-plugins).
See the [POM file](https://github.com/kevinsawicki/github-maven-example/blob/master/example/pom.xml)
for how the downloads plugin and site plugin are configured.
# Getting started
* Fork this project
* Update the `pom.xml` file `<url>` element to be the address of your fork
* Optionally update `<scm>` and `<developers>` section as well to have the information for your fork
* Add the following to your Maven `settings.xml` file updated with your GitHub login name and password:
```xml
<servers>
<server>
<id>github</id>
<username>user</username>
<password>password</password>
</server>
</servers>
```
# Using the downloads plugin
```
$ cd github-maven-example/example
$ mvn clean install
```
The compiled, source, and Javadoc JAR files will be uploaded as downloads [here](https://github.com/kevinsawicki/github-maven-example/downloads).
# Using the site plugin
```
$ cd github-maven-example/example
$ mvn site
```
The generated site will be committed to the [gh-pages branch](https://github.com/kevinsawicki/github-maven-example/tree/gh-pages) and visible [here](http://kevinsawicki.github.com/github-maven-example/).
| 1 |
Red5/red5-examples | Example code for use with Red5 projects | java | red5-examples
=============
Example code for use with Red5 projects
| 1 |
shiffman/Box2D-for-Processing | Processing JBox2D helper library and examples | null | # Box2D for Processing
A Processing library wrapping JBox2D (http://www.jbox2d.org/).
Download library: http://shiffman-archive.netlify.app/p5/libraries/box2d_processing/box2d_processing.zip
Tutorial and further examples for this library are available in The Nature of Code book: http://natureofcode.com.
| 0 |
SpoonLabs/spoon-examples | Examples on how to use the Spoon Java source code transformation library | null | # Spoon Examples
## Introduction
spoon-examples gives analysis and transformation processors showing the usage of the open-source library [Spoon](https://github.com/INRIA/spoon).
You can see these processors in:
- [`src/main/java/fr/inria/gforge/spoon/analysis`](https://github.com/SpoonLabs/spoon-examples/tree/master/src/main/java/fr/inria/gforge/spoon/analysis) for analysis.
- [`src/main/java/fr/inria/gforge/spoon/transformation`](https://github.com/SpoonLabs/spoon-examples/tree/master/src/main/java/fr/inria/gforge/spoon/transformation) for transformation.
- [notnullcheck](https://github.com/SpoonLabs/spoon-examples/tree/master/src/main/java/fr/inria/gforge/spoon/transformation/notnullcheck) improves reliability
- [bound](https://github.com/SpoonLabs/spoon-examples/tree/master/src/main/java/fr/inria/gforge/spoon/transformation/bound) is a transformation based on annotations
- [mutation](https://github.com/SpoonLabs/spoon-examples/tree/master/src/main/java/fr/inria/gforge/spoon/transformation/mutation) is a simple mutation testing engine
- [spoonerism](https://github.com/SpoonLabs/spoon-examples/tree/master/src/main/java/fr/inria/gforge/spoon/transformation/spoonerism) a basic example of transforming classes to extend a common parent class. Accompanied by the [spoonerism.fodp](https://github.com/SpoonLabs/spoon-examples/blob/master/docs/spoonerism.fodp) presentation.
## Usage
You can run the tests of the project with a `mvn test` command on the root of the project to execute all examples (all test classes).
```console
git clone https://github.com/SpoonLabs/spoon-examples.git
cd spoon-examples
mvn test
```
| 0 |
fusioninsight/fusioninsight_hd_examples | null | null | Hello Fusioninsight_HD_Examples | 0 |
mark-watson/Java-AI-Book-Code | Code examples for my Java artificial intelligence book | null | # Code for the 2020 edition of "Practical Artificial Intelligence With Java"
The previous edition was released in 2013. The new 2020 edition is largely a rewrite of older material with the addition of new material. The 2020 edition was published July 28, 2020 and this repository was updated to remove all old code and add new and modified examples. See below for information on getting the old code and the PDF for the 2013 edition.
[Leanpub Link for latest edition](https://leanpub.com/javaai)
This book is a combination of
- new coverage of deep learning
- new material: creating and using knowledge graphs
- examples from my discontinued book "Power Java": anomaly detection, linked data, using DBPedia, OpenNLP, and web scraping
- examples from the original editions of this book: genetic algorithms and search algorithms
- a few examples updated from my discontinued book "Practical Semantic Web and Linked Data Applications, Java Edition"
You can find the older code for the 2013 4th edition here: [https://github.com/mark-watson/Java-AI-Book-Code_4th_edition](https://github.com/mark-watson/Java-AI-Book-Code_4th_edition)
| 0 |
skadistats/clarity-examples | Example code for clarity | null | # Clarity-examples
This project contains example code for the [clarity replay parser](https://github.com/skadistats/clarity).
## Introduction
Clarity 2 uses an event based approach to replay analysis. To use it, you have to supply one or more
processors to clarity. A processor is a simple POJO, that you enrich with annotations, which tell
clarity what kind of data you want to receive.
This simple yet fully working example prints all messages from all chat (Source 2):
```java
public class AllChatProcessor {
@OnMessage(S2UserMessages.CUserMessageSayText2.class)
public void onMessage(Context ctx, S2UserMessages.CUserMessageSayText2 message) {
System.out.format("%s: %s\n", message.getParam1(), message.getParam2());
}
public static void main(String[] args) throws Exception {
// 1) create an input source from the replay
Source source = new MappedFileSource("replay.dem");
// 2) create a simple runner that will read the replay once
SimpleRunner runner = new SimpleRunner(source);
// 3) create an instance of your processor
AllChatProcessor processor = new AllChatProcessor();
// 4) and hand it over to the runner
runner.runWith(processor);
}
}
```
The main method does the following:
1. Creates a source from the replay file. In this case, a MappedFileSource is used, which needs a locally available file
to work. This is the fastest implementation, but there is also an InputStreamSource, which lets you create a source
from any InputStream you can come up with.
2. Create a runner with your source. The runner is what drives the replay analysis. The SimpleRunner we use in this case
will simply run over the whole replay once. There is also a more sophisticated ControllableRunner, which uses a separate
thread for doing the work, and which allows seeking back and forth in the replay.
3. Create an instance of your processor. Please note that you are not limited to only using one processor, and clarity itself
contains a lot of processors that might take part in the run if what you requested requires it.
4. This starts the processing run. Your annotated method onMessage() will be called back whenever clarity finds an
allchat-message in the replay.
### Building / running the examples
All provided examples can be build with Gradle. The build process yields an "uno-jar", that is a jar
containing all the dependencies, which can be called from the command line easily without having to
set a correct classpath. Alternatively, you can use Gradle to run an example directly.
All following commands have to be issued in the root of the project.
#### Building
Windows:
gradlew.bat <exampleName>Package
Linux / Mac:
./gradlew <exampleName>Package
#### Running the built uno-jar
Windows:
java -jar build\libs\<exampleName>.jar replay.dem
Linux / Mac:
java -jar build/libs/<exampleName>.jar replay.dem
#### Running from Gradle
Windows:
gradlew.bat <exampleName>Run --args "path\to\replay.dem"
Linux / Mac:
./gradlew <exampleName>Run --args "path/to/replay.dem"
### Logging
Clarity uses the logback-library for logging. You can enable logging for certain packages by changing
`src/main/resources/logback.xml`.
## Examples
### AllChat
You can find an executable example of the example above under [skadistats.clarity.examples.allchat.Main.java](https://github.com/skadistats/clarity-examples/blob/master/src/main/java/skadistats/clarity/examples/allchat/Main.java).
Follow the instructions above to build and run it with
<exampleName> = allchat
### Watching the data in real time
[Clarity Analyzer](https://github.com/spheenik/clarity-analyzer) is nifty little JavaFX Application
that lets you see all the entity data in the replay in real time.

### Showing the combat log
This example *almost* replicates what is shown on the combat log from the game.
It has problems with finding out if some modifier applied to a unit is a buff or a debuff,
and it doesn't know how to convert the technical hero names to plain english... but otherwise it has it all :)
You can find it under [skadistats.clarity.examples.combatlog.Main.java](https://github.com/skadistats/clarity-examples/blob/master/src/main/java/skadistats/clarity/examples/combatlog/Main.java).
Follow the instructions above to build and run it with
<exampleName> = combatlog
### Show stats at the end of the game
This example shows how to use the PlayerResource entity as well as the ControllableRunner.
It outputs the score table at the end of the match. For getting to the result as fast as possible, it does not
run the complete replay, but instead uses the ControllableRunner to directly seek to the last tick in the replay.
You can find it under [skadistats.clarity.examples.matchend.Main.java](https://github.com/skadistats/clarity-examples/blob/master/src/main/java/skadistats/clarity/examples/matchend/Main.java).
Follow the instructions above to build and run it with
<exampleName> = matchend
### Tracking spawns / deaths
This example shows how to write a processor that provides events related to the lifestate of an entity.
The processor provides 3 new events (`@OnEntitySpawned`, `@OnEntityDying` and `@OnEntityDied`) and an associated
main class that uses them.
You can find the processor under [skadistats.clarity.examples.lifestate.SpawnsAndDeaths.java](https://github.com/skadistats/clarity-examples/blob/master/src/main/java/skadistats/clarity/examples/lifestate/SpawnsAndDeaths.java),
and the class that uses it under [skadistats.clarity.examples.lifestate.Main.java](https://github.com/skadistats/clarity-examples/blob/master/src/main/java/skadistats/clarity/examples/lifestate/Main.java).
Follow the instructions above to build and run it with
<exampleName> = lifestate
### Retrieving basic game info
For retrieving the basic game information (players, picks, bans, who won),
you do not need to iterate the replay. You can retrieve that info with the following code
```Java
public class Main {
public static void main(String[] args) throws Exception {
CDemoFileInfo info = Clarity.infoForFile(args[0]);
System.out.println(info);
}
}
```
You can find this example under [skadistats.clarity.examples.info.Main.java](https://github.com/skadistats/clarity-examples/blob/master/src/main/java/skadistats/clarity/examples/info/Main.java).
Follow the instructions above to build and run it with
<exampleName> = info
### Send table inspection (Source 1)
Dota 2 is a game made with the Source engine from Valve. Source manages a set of networked entities
which exist on the server and are propagated to the client. A lot of stuff you see in a dota match is a networked entity,
for example the heros, creeps and buildings, but also statistical information about the game, like
the current game time, scoreboard, etc. You can find some information about networked entities in the
[Valve Developer Community Wiki](https://developer.valvesoftware.com/wiki/Networking_Entities).
Since the Dota client is constantly changing and improving, there is no fixed format for what data (properties) these
entities contain. To be able to replay a replay recorded on an old client on a newer version, the replay
contains definitions of exactly what entities with what properties it contains. These definitions are
called send tables.
This example shows the format of the entity data in a certain replay.
You can find it under [skadistats.clarity.examples.dtinspector.Main.java](https://github.com/skadistats/clarity-examples/blob/master/src/main/java/skadistats/clarity/examples/dtinspector/Main.java).
Follow the instructions above to build and run it with
<exampleName> = dtinspector
and it will open a window which lets you explore the send tables in an interactive manner.
## Under the hood
### Events / Providers
Clarity is driven by a small annotation driven event system. Clarity provides basic events, like @OnMessage,
which is used to get a callback whenever a message of a certain type is found in the replay.
If you want, you can subscribe to those events directly, for example to create a dump of the replay.
But those events can also be used to listen for certain data in the replay and refine the raw data into more
sophisticated events. One example from Clarity is the GameEvents processor, which listens for raw messages of type
CSVCMsg_GameEventList and CSVCMsg_GameEvent and transforms their content into an easier to use form:
```java
@Provides(OnGameEvent.class) // 1. register as a provider for @OnGameEvent
public class GameEvents {
@OnMessage(NetMessages.CSVCMsg_GameEventList.class)
public void onGameEventList(Context ctx, NetMessages.CSVCMsg_GameEventList message) {
// 2. process the incoming message, and create GameEventDescriptors from it
}
@OnMessage(NetworkBaseTypes.CSVCMsg_GameEvent.class)
public void onGameEvent(Context ctx, NetworkBaseTypes.CSVCMsg_GameEvent message) {
// 3. use the GameEventDescriptors from 2, to create a single GameEvent
GameEvent e = new GameEvent(descriptor);
// 4. raise @OnGameEvent
ctx.createEvent(OnGameEvent.class, GameEvent.class).raise(e);
}
```
1. the @Provides-annotation tells clarity that this processor is able to supply @OnGameEvent events.
So whenever some processor gets added to the run that listens for this event, Clarity will make sure an instance
of GameEvents is also part of the run to supply those events.
2. The exact structure of GameEvents in this replay is encoded in a CSVCMsg_GameEventList message.
3. Create a single GameEvent, by using the descriptors created in 2.
4. fire the @OnGameEvent event, passing the created GameEvent as parameter.
Another example for creating your own event provider is [a provider for spawn / death events](https://github.com/skadistats/clarity-examples/blob/master/src/main/java/skadistats/clarity/examples/lifestate/SpawnsAndDeaths.java).
### Context
The first parameter on any event listener called by Clarity is a Context object.
You can use it to do useful stuff:
```java
public class Context {
// 1. get a reference to another processor also taking part in the run
public <T> T getProcessor(Class<T> processorClass) {}
// 2. query the current tick
public int getTick() {}
// 3. query the engine type the replay was recorded with
public EngineType getEngineType() {}
// 4. query the build number the replay was recorded with (Source 2 only)
public int getBuildNumber() {}
// 5. raise an event yourself
public <A extends Annotation> Event<A> createEvent(Class<A> eventType, Class... parameterTypes) {}
}
```
1. Often times you need a reference to another processor. You could get a reference to the mentioned GameEvents processor
by calling `ctx.getProcessor(GameEvents.class)`.
2. returns the current tick
3. returns the type of engine (Source 1 or 2) the replay was recorded with.
4. if the replay was recorded with Source 2, this will give you the build number of the server that recorded the replay
5. this function can be used to create events yourself.
| 1 |
eomjinyoung/JavaWebProgramming | Examples for Java web programming book | null | null | 0 |
allure-examples/allure-examples | allure-examples core | null | # Allure Examples
Allure Report links auto redirect to the last build
## allure-java-commons
[](https://github.com/allure-examples/allure-examples/actions?query=workflow%3Aallure-java-commons)
[](https://github.com/allure-examples/allure-java-commons)
[](https://allure-examples.github.io/allure-java-commons/)
## allure-junit5
[](https://github.com/allure-examples/allure-examples/actions?query=workflow%3Aallure-junit5)
[](https://github.com/allure-examples/allure-junit5-gradle)
[](https://allure-examples.github.io/allure-junit5-gradle/)
[](https://github.com/allure-examples/allure-junit5-gradle-kts)
[](https://allure-examples.github.io/allure-junit5-gradle-kts/)
[](https://github.com/allure-examples/allure-junit5-maven)
[](https://allure-examples.github.io/allure-junit5-maven/)
## allure-junit4
[](https://github.com/allure-examples/allure-examples/actions?query=workflow%3Aallure-junit4)
[](https://github.com/allure-examples/allure-junit4-gradle)
[](https://allure-examples.github.io/allure-junit4-gradle/)
[](https://github.com/allure-examples/allure-junit4-gradle-kts)
[](https://allure-examples.github.io/allure-junit4-gradle-kts/)
[](https://github.com/allure-examples/allure-junit4-maven)
[](https://allure-examples.github.io/allure-junit4-maven/)
## allure-testng
[](https://github.com/allure-examples/allure-examples/actions?query=workflow%3Aallure-testng)
[](https://github.com/allure-examples/allure-testng-gradle)
[](https://allure-examples.github.io/allure-testng-gradle/)
[](https://github.com/allure-examples/allure-testng-gradle-kts)
[](https://allure-examples.github.io/allure-testng-gradle-kts/)
[](https://github.com/allure-examples/allure-testng-maven)
[](https://allure-examples.github.io/allure-testng-maven/)
## allure-cucumber5-junit4
[](https://github.com/allure-examples/allure-examples/actions?query=workflow%3Aallure-cucumber5-junit4)
[](https://github.com/allure-examples/allure-cucumber5-junit4-gradle)
[](https://allure-examples.github.io/allure-cucumber5-junit4-gradle/)
[](https://github.com/allure-examples/allure-cucumber5-junit4-gradle-kts)
[](https://allure-examples.github.io/allure-cucumber5-junit4-gradle-kts/)
[](https://github.com/allure-examples/allure-cucumber5-junit4-maven)
[](https://allure-examples.github.io/allure-cucumber5-junit4-maven/)
## allure-cucumber5-testng
[](https://github.com/allure-examples/allure-examples/actions?query=workflow%3Aallure-cucumber5-testng)
[](https://github.com/allure-examples/allure-cucumber5-testng-gradle)
[](https://allure-examples.github.io/allure-cucumber5-testng-gradle/)
[](https://github.com/allure-examples/allure-cucumber5-testng-gradle-kts)
[](https://allure-examples.github.io/allure-cucumber5-testng-gradle-kts/)
[](https://github.com/allure-examples/allure-cucumber5-testng-maven)
[](https://allure-examples.github.io/allure-cucumber5-testng-maven/)
## allure-python
[](https://github.com/allure-examples/allure-examples/actions?query=workflow%3Aallure-python)
[](https://github.com/allure-examples/allure-python-pytest)
[](https://allure-examples.github.io/allure-python-pytest/)
[](https://github.com/allure-examples/allure-python-behave)
[](https://allure-examples.github.io/allure-python-behave/)
[](https://github.com/allure-examples/allure-python-robotframework)
[](https://allure-examples.github.io/allure-python-robotframework/)
## allure-javascript
[](https://github.com/allure-examples/allure-examples/actions?query=workflow%3Aallure-javascript)
[](https://github.com/allure-examples/allure-javascript-codeceptjs)
[](https://allure-examples.github.io/allure-javascript-codeceptjs/)
[](https://github.com/allure-examples/allure-javascript-cucumberjs)
[](https://allure-examples.github.io/allure-javascript-cucumberjs/)
[](https://github.com/allure-examples/allure-javascript-jest)
[](https://allure-examples.github.io/allure-javascript-jest/)
## allure-kotlin-junit5
[](https://github.com/allure-examples/allure-examples/actions?query=workflow%3Aallure-kotlin-junit5)
[](https://github.com/allure-examples/allure-kotlin-junit5-gradle-kts)
[](https://allure-examples.github.io/allure-kotlin-junit5-gradle-kts/) | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.