Skip to content

Commit

Permalink
Global plugins and swagger (#50)
Browse files Browse the repository at this point in the history
* [ALL] Refactor for global plugins
* [ALL] Adding report plugins
* [ALL] Restructured plugin structure to allow multiple handle per file
* [ALL] Added swagger
* [ALL] Fixing apis
* [ALL] Added status api for docker
* [ALL] Removed any reference to spring!
* [ALL] Adding upload form for swagger
* [HTTP] Handling mixed connection situation
* [QUEUEUS] reset connection on start replaying. When starting replay on an already active server
* [ALL] Disconnect clients on disconnecting protocol
* [GLOBAL] Download settings
* [GLOBAL] Fix timeout expired test
* [GLOBAL] Fix not setting connection id on replayed items
* [QUEUE] Fix connecting logically queues and names
* [QUEUE] Sleep waiting for write
* [ALL] Saving runner and jacoco artifacts
* [JACOCO] report name to coverage-report-html.zip
* [HTML] Add waiter on test
* [ALL] Fixes for sequentiality of runs
* [ALL] Documentations
* [ALL] Fixed post write behaviour
* [MQTT] Missing packet identifier on publishrec
* [PSOTGRES] Multiple queries within single query
* Moved swagger-ui to standard path
* Reformat
* Cleanup
  • Loading branch information
kendarorg authored Dec 14, 2024
1 parent 48bfc5b commit 49ca982
Show file tree
Hide file tree
Showing 341 changed files with 19,502 additions and 2,145 deletions.
1 change: 1 addition & 0 deletions .idea/dataSources.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/misc.xml

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

15 changes: 15 additions & 0 deletions .idea/runConfigurations/LocalDocker.xml

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

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ java -jar protocol-runner.jar -protocol http -proxy 9999 \
The configuration is based on command line parameters or a json properties file
for the usage check [here](docs/properties.md)

For the api usage [here](docs/apis.md)
For the api usage here is the swagger: http//localhost:apisPort/swagger-ui/index.html

If you want to go on the specific functions by protocol:

Expand Down
9 changes: 7 additions & 2 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@

### Code

* findIndex,readStorageItem
* AMQP
* Redis
* Mongo
* Jdbc (set)
* Mysql (show warnings)
* Http (favicon)
* Mocked specific responses for mongo, redis
* Expose the connections for protocol on apis
* Send mock messages amqp,mqtt,redis
* Remove spring boot
* Remove withstorage
* Http
* test brotli compression
* Use anonymous Object for serialization for HTTP Multipart
Expand Down
55 changes: 0 additions & 55 deletions docs/apis.md

This file was deleted.

69 changes: 65 additions & 4 deletions jacoco/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,26 @@
<artifactId>jacoco</artifactId>
<dependencies>

<dependency>
<!--<dependency>
<groupId>org.kendar.protocol</groupId>
<artifactId>protocol-mongo</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>org.kendar.protocol</groupId>
<artifactId>protocol-common</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>org.kendar.protocol</groupId>
<artifactId>protocol-common-jdbc</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>org.kendar.protocol</groupId>
<artifactId>protocol-runner</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>org.kendar.protocol</groupId>
<artifactId>protocol-postgres</artifactId>
Expand All @@ -39,7 +54,7 @@
<groupId>org.kendar.protocol</groupId>
<artifactId>protocol-http</artifactId>
<version>${revision}</version>
</dependency>
</dependency>-->
</dependencies>


Expand All @@ -51,14 +66,33 @@
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>${assembly.plugin.version}</version>
<configuration>
<descriptors>
<descriptor>src/main/resources/zip.xml</descriptor>
</descriptors>
<finalName>jacoco-report</finalName>
</configuration>
<executions>
<execution>
<id>make-assembly</id> <!-- this is used for inheritance merges -->
<phase>install</phase> <!-- append to the packaging phase. -->
<goals>
<goal>single</goal> <!-- goals == mojos -->
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<version>${antrun.plugin.version}</version>
<executions>
<execution>
<phase>test</phase>
<phase>compile</phase>
<goals>
<goal>run</goal>
</goals>
Expand All @@ -79,6 +113,9 @@
<fileset dir="${basedir}/../protocol-common/target">
<include name="*.exec"/>
</fileset>
<fileset dir="${basedir}/../protocol-common-jdbc/target">
<include name="*.exec"/>
</fileset>
<fileset dir="${basedir}/../protocol-mongo/target">
<include name="*.exec"/>
</fileset>
Expand All @@ -94,6 +131,12 @@
<fileset dir="${basedir}/../protocol-redis/target">
<include name="*.exec"/>
</fileset>
<fileset dir="${basedir}/../protocol-runner/target">
<include name="*.exec"/>
</fileset>
<fileset dir="${basedir}/../protocol-http/target">
<include name="*.exec"/>
</fileset>
</executiondata>
<structure name="Integration Tests Coverage Report">
<sourcefiles encoding="UTF-8">
Expand All @@ -112,6 +155,15 @@
<dirset dir="${basedir}/../protocol-postgres">
<include name="**/src/main/java"/>
</dirset>
<dirset dir="${basedir}/../protocol-runner">
<include name="**/src/main/java"/>
</dirset>
<dirset dir="${basedir}/../protocol-http">
<include name="**/src/main/java"/>
</dirset>
<dirset dir="${basedir}/../protocol-common-jdbc">
<include name="**/src/main/java"/>
</dirset>
</sourcefiles>
<classfiles>
<fileset dir="${basedir}/../protocol-amqp-091/target/classes">
Expand All @@ -120,6 +172,9 @@
<fileset dir="${basedir}/../protocol-common/target/classes">
<include name="org/kendar/**/*"/>
</fileset>
<fileset dir="${basedir}/../protocol-common-jdbc/target/classes">
<include name="org/kendar/**/*"/>
</fileset>
<fileset dir="${basedir}/../protocol-mongo/target/classes">
<include name="org/kendar/**/*"/>
</fileset>
Expand All @@ -129,6 +184,12 @@
<fileset dir="${basedir}/../protocol-postgres/target/classes">
<include name="org/kendar/**/*"/>
</fileset>
<fileset dir="${basedir}/../protocol-mongo/target/classes">
<include name="org/kendar/**/*"/>
</fileset>
<fileset dir="${basedir}/../protocol-runner/target/classes">
<include name="org/kendar/**/*"/>
</fileset>
</classfiles>
</structure>
<html destdir="${basedir}/target/coverage-report/html"/>
Expand Down
14 changes: 14 additions & 0 deletions jacoco/src/main/resources/zip.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<assembly xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>html</id>
<baseDirectory>/</baseDirectory>
<formats>
<format>zip</format>
</formats>
<fileSets>
<fileSet>
<directory>${project.build.directory}/coverage-report/html</directory>
</fileSet>
</fileSets>
</assembly>
13 changes: 10 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</modules>

<properties>
<revision>2.1.5</revision>
<revision>2.2.0</revision>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>11</maven.compiler.source>
Expand All @@ -40,7 +40,6 @@
<snappy.version>1.1.8.4</snappy.version>
<zstd.version>1.5.2-2</zstd.version>
<hibernate.version>5.4.0.Final</hibernate.version>
<jaxb.api.version>2.3.0</jaxb.api.version>
<amqp.client.version>5.20.0</amqp.client.version>
<jedis.version>5.1.2</jedis.version>
<commons.io.version>2.7</commons.io.version>
Expand All @@ -52,6 +51,14 @@
<json.schema.validator.version>1.0.66</json.schema.validator.version>
<pl4j.version>3.12.1</pl4j.version>
<bouncycastle.version>1.68</bouncycastle.version>
<commons.fileupload.version>1.3.3</commons.fileupload.version>
<guava.version>31.1-jre</guava.version>
<swagger.version>2.2.1</swagger.version>
<assembly.plugin.version>3.7.1</assembly.plugin.version>
<deploy.plugin.version>3.1.3</deploy.plugin.version>
<surfire.plugin.version>3.5.2</surfire.plugin.version>
<compiler.plugin.version>3.13.0</compiler.plugin.version>
<antrun.plugin.version>3.1.0</antrun.plugin.version>
</properties>
<dependencies>
<!-- <dependency>-->
Expand Down Expand Up @@ -163,7 +170,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</version>
<version>${surfire.plugin.version}</version>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
Expand Down
3 changes: 3 additions & 0 deletions protocol-amqp-091/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ All callback are recorded

* active: If it is active
* ignoreTrivialCalls: store in full only calls that cannot be generated automatically (the ones with real data)
* resetConnectionsOnStart: reset connection on start replaying. When starting replay on an already active server

### replay-plugin

Expand All @@ -31,6 +32,8 @@ All callback are replayed automatically

* active: If it is active
* respectCallDuration: respect the duration of the round trip
* resetConnectionsOnStart: reset connection on start replaying. When starting replay on an already active server
* blockExternal: Block calls to real service when not matching (default true)

## Documentation used

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public AmqpProtoContext(ProtoDescriptor descriptor, int contextId) {

@Override
public void disconnect(Object connection) {
super.disconnect(connection);
ProxyConnection conn = ((ProxyConnection) getValue("CONNECTION"));
var sock = (AmqpProxySocket) conn.getConnection();
if (sock != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public class BodyFrame extends Frame {
private byte[] contentBytes;
private String contentString;
private int consumeId;
private String consumeOrigin;

public BodyFrame() {
setType(FrameType.BODY.asByte());
Expand Down Expand Up @@ -67,19 +68,23 @@ protected Iterator<ProtoStep> executeFrame(short channel, BBuffer rb, AmqpFrame
}


var routingKey = context.getValue("BASIC_PUBLISH_RK_" + channel);
var exchange = context.getValue("BASIC_PUBLISH_XC_" + channel);

var bf = new BodyFrame();
bf.setChannel(channel);
bf.setContentBytes(contentBytes);
bf.setContentString(contentString);
if (isProxyed()) {
var basicConsume = (BasicConsume) context.getValue("BASIC_CONSUME_CH_" + channel);
bf.setConsumeId(basicConsume.getConsumeId());

var consumeOrigin = basicConsume.getQueue() + "|" + basicConsume.getChannel() + "|" + mapper.serialize(basicConsume.getArguments());
bf.setConsumeOrigin(consumeOrigin);

//If it is a recorder
if (!proxy.isReplayer()) {

proxy.respond(bf, new PluginContext("AMQP", "RESPONSE", -1, context));
proxy.respond(bf, new PluginContext("AMQP", "RESPONSE", System.currentTimeMillis(), context));
}
//Return itself
return iteratorOfList(bf);
Expand Down Expand Up @@ -114,4 +119,12 @@ public int getConsumeId() {
public void setConsumeId(int consumeId) {
this.consumeId = consumeId;
}

public String getConsumeOrigin() {
return consumeOrigin;
}

public void setConsumeOrigin(String consumeOrigin) {
this.consumeOrigin = consumeOrigin;
}
}
Loading

0 comments on commit 49ca982

Please sign in to comment.