Skip to content

Commit

Permalink
Merge branch 'amqp_intergration'
Browse files Browse the repository at this point in the history
  • Loading branch information
kendarorg committed Feb 21, 2024
2 parents 05b075f + 6c16af9 commit 2ff5c36
Show file tree
Hide file tree
Showing 308 changed files with 9,929 additions and 1,194 deletions.
6 changes: 5 additions & 1 deletion .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/crystal.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 18 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,29 @@ want to try it quickly)
* Translate the queries in a standard, serializable format, logging all queries
and results in a consistent way
* Forward wire protocol to drivers. For SQL means passing the queries to JDBC drivers,
for NO-SQL forwarding to the specific ones like MongoDB or Redis
for NO-SQL forwarding to the specific ones like MongoDB or AMQP
* Run queries against a pre-recorded sequence of commands to simulate a real data
storage, without the need of a real server (in the making)

The whole project is covered with Jacoco (66% coverage actually)

For this to become real an event based state machine has been developed, with
several database wire protocol implementations:

* [PostgresSQL](protocol-postgres/README.md) Usable for most db (for hibernate you should set the final db dialect of
* [PostgresSQL](protocol-postgres/README.md) Usable for most db (for hibernate you should set the final db dialect of
course)
* Support for simple and extended query protocol
* Transactions
* Simple authentication (could add an "auth provider")
* Support for simple and extended query protocol
* Transactions
* Simple authentication (could add an "auth provider")
* [MySQL](protocol-mysql/README.md)
* Support for cached queries and stored procedures
* Simple authentication (could add an "auth provider")
* Support for cached queries and stored procedures
* Simple authentication (could add an "auth provider")
* [MongoDB](protocol-mongo/README.md)
* Basic authentication
* [RabbitMq/AMQP 0.9.1](protocol-amqp-091/README.md)
* Support for basic queue/publish/consume
* Channels multiplexing
* Redis (soon)
* ActiveMQ (soon)

## If you like it Buy me a coffe :)

Expand All @@ -35,9 +40,9 @@ several database wire protocol implementations:
## Using it out of the box

You can use the "protocol-runner-VERSION.jar" to proxy all your calls and test your
connections (and add some ISSUE to this project hopefully).
connections (and add some ISSUE to this project hopefully).

Inside protocol-runner/src/test/java/org/kenndar/runner/MainTest.java you can see
Inside protocol-runner/src/test/java/org/kenndar/runner/MainTest.java you can see
an example where a recording is made and then reporduced.

Just call it like the following:
Expand All @@ -52,16 +57,17 @@ Just call it like the following:
<pre>
usage: runner
-l <arg> Select listening port
-p <arg> Select protocol (mysql/mongo/postgres
-p <arg> Select protocol (mysql/mongo/postgres/amqp091)
-pl Replay from log directory
-xc <arg> Select remote connection string
-xd <arg> Select remote log directory (you can set a {timestamp} value
that will be replaced with the current timestamp)
-xl <arg> Select remote login
-xw <arg> Select remote password
-v <arg> Log level (default ERROR)
</pre>

Inside the choosen directory you will find simple jsons containing all the data exchanged
Inside the chosen directory you will find simple jsons containing all the data exchanged
with the server AND you can modify it before replaying, to simulate special situations!

## The state machine
Expand Down
4 changes: 3 additions & 1 deletion TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
* Timeouts
* Run from command line
* Recording asynchronously
* Replaying
* Replaying

STATE CHARTS: https://github.com/klangfarbe/UML-Statechart-Framework-for-Java
134 changes: 134 additions & 0 deletions jacoco/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
<project>
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.kendar.protocol</groupId>
<artifactId>protocol-master</artifactId>
<version>1.1.0</version>
</parent>

<artifactId>jacoco</artifactId>
<dependencies>

<dependency>
<groupId>org.kendar.protocol</groupId>
<artifactId>protocol-mongo</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.kendar.protocol</groupId>
<artifactId>protocol-postgres</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.kendar.protocol</groupId>
<artifactId>protocol-amqp-091</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.kendar.protocol</groupId>
<artifactId>protocol-mysql</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>


<build>
<plugins>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target name="report">
<echo message="Generating JaCoCo Reports"/>
<taskdef name="report"
classname="org.jacoco.ant.ReportTask">
<classpath
path="**/*.jar"/>
</taskdef>
<mkdir dir="${basedir}/target/coverage-report"/>
<report>
<executiondata>
<fileset dir="${basedir}/../protocol-amqp-091/target">
<include name="*.exec"/>
</fileset>
<fileset dir="${basedir}/../protocol-common/target">
<include name="*.exec"/>
</fileset>
<fileset dir="${basedir}/../protocol-mongo/target">
<include name="*.exec"/>
</fileset>
<fileset dir="${basedir}/../protocol-mysql/target">
<include name="*.exec"/>
</fileset>
<fileset dir="${basedir}/../protocol-postgres/target">
<include name="*.exec"/>
</fileset>
</executiondata>
<structure name="Integration Tests Coverage Report">
<sourcefiles encoding="UTF-8">
<dirset dir="${basedir}/../protocol-amqp-091">
<include name="**/src/main/java"/>
</dirset>
<dirset dir="${basedir}/../protocol-common">
<include name="**/src/main/java"/>
</dirset>
<dirset dir="${basedir}/../protocol-mongo">
<include name="**/src/main/java"/>
</dirset>
<dirset dir="${basedir}/../protocol-mysql">
<include name="**/src/main/java"/>
</dirset>
<dirset dir="${basedir}/../protocol-postgres">
<include name="**/src/main/java"/>
</dirset>
</sourcefiles>
<classfiles>
<fileset dir="${basedir}/../protocol-amqp-091/target/classes">
<include name="org/kendar/**/*"/>
</fileset>
<fileset dir="${basedir}/../protocol-common/target/classes">
<include name="org/kendar/**/*"/>
</fileset>
<fileset dir="${basedir}/../protocol-mongo/target/classes">
<include name="org/kendar/**/*"/>
</fileset>
<fileset dir="${basedir}/../protocol-mysql/target/classes">
<include name="org/kendar/**/*"/>
</fileset>
<fileset dir="${basedir}/../protocol-postgres/target/classes">
<include name="org/kendar/**/*"/>
</fileset>
</classfiles>
</structure>
<html destdir="${basedir}/target/coverage-report/html"/>
</report>
</target>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.jacoco</groupId>
<artifactId>org.jacoco.ant</artifactId>
<version>0.8.2</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
42 changes: 24 additions & 18 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>org.kendar.protocol</groupId>
<artifactId>protocol-master</artifactId>
<version>1.0.0</version>
<version>1.1.0</version>
<packaging>pom</packaging>

<modules>
Expand All @@ -15,16 +15,16 @@
<module>protocol-postgres</module>
<module>protocol-mongo</module>
<module>protocol-mysql</module>
<module>protocol-redis</module>
<module>protocol-runner</module>
<module>protocol-amqp-091</module>
<module>jacoco</module>
</modules>

<properties>
<project.version>1.0.0</project.version>
<project.version>1.1.0</project.version>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>11</maven.compiler.source>
<testcontainers.version>1.19.1</testcontainers.version>
<log4j.version>2.17.1</log4j.version>
<junit.jupiter.version>RELEASE</junit.jupiter.version>
<mybatis.version>3.5.7</mybatis.version>
<mysql.version>8.2.0</mysql.version>
Expand All @@ -37,9 +37,26 @@
<hibernate.version>5.2.6.Final</hibernate.version>
<jaxb.api.version>2.3.0</jaxb.api.version>
<commons.cli.version>1.6.0</commons.cli.version>
<amqp.client.version>5.20.0</amqp.client.version>
<logback.version>1.4.8</logback.version>
<slf4j.version>2.0.7</slf4j.version>
</properties>

<dependencies>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
Expand All @@ -62,16 +79,6 @@
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j.version}</version>
</dependency>
</dependencies>
<repositories>

Expand All @@ -98,7 +105,6 @@
<id>central2</id>
<name>Central Repository2</name>
<url>https://repo.maven.apache.org/maven2</url>
<!-- https://repo.maven.apache.org/maven2 -->
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
Expand Down Expand Up @@ -128,7 +134,7 @@
</systemProperties>
</configuration>
</plugin>
<!--<plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.8</version>
Expand All @@ -145,7 +151,7 @@
</goals>
</execution>
</executions>
</plugin>-->
</plugin>
</plugins>
</build>

Expand Down
22 changes: 22 additions & 0 deletions protocol-amqp-091/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## AMQP 0.9.1 Protocol

## Documentation used

* https://www.rabbitmq.com/resources/specs/amqp0-9-1.pdf (page 31)
* https://docs.vmware.com/en/VMware-RabbitMQ-for-Kubernetes/1/rmq/amqp-wireshark.html
* https://dzone.com/refcardz/amqp-essentials (amqp 1.0)
* https://github.com/cloudamqp/amqproxy
* https://crystal-lang.org/api/1.11.2
* https://github.com/wireshark/wireshark/blob/master/epan/dissectors/packet-amqp.c
* https://github.com/bloomberg/amqpprox/tree/main/libamqpprox
* https://stackoverflow.com/questions/18403623/rabbitmq-amqp-basicproperties-builder-values
* https://www.ascii-code.com/


* v0.9.1 vs 0.10.0
* https://github.com/rabbitmq/rabbitmq-server/blob/main/deps/rabbitmq_amqp1_0/README.md

## Weirdness

amqp0-9-1.pdf, section 4.2.3
The size is an INTEGER not a long
Loading

0 comments on commit 2ff5c36

Please sign in to comment.