diff --git a/agent/src/main/java/io/keploy/advice/redis/jedis/JedisPoolResource_Advice.java b/agent/src/main/java/io/keploy/advice/redis/jedis/JedisPoolResource_Advice.java
deleted file mode 100644
index 4f469520..00000000
--- a/agent/src/main/java/io/keploy/advice/redis/jedis/JedisPoolResource_Advice.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package io.keploy.advice.redis.jedis;
-
-import io.keploy.regression.Mode;
-import io.keploy.regression.context.Context;
-import io.keploy.regression.context.Kcontext;
-import net.bytebuddy.asm.Advice;
-import org.slf4j.LoggerFactory;
-import org.slf4j.Logger;
-import redis.clients.jedis.Jedis;
-import redis.clients.jedis.JedisPool;
-
-import java.util.Objects;
-
-import static net.bytebuddy.implementation.bytecode.assign.Assigner.Typing.DYNAMIC;
-
-/**
- * Class {@link JedisPoolResource_Advice} is used for intercepting method {@link JedisPool#getResource()} and returning
- * {@link Jedis} object when Keploy is in TEST_MODE.
- *
- * @author charankamarapu
- */
-public class JedisPoolResource_Advice {
-
- /**
- * This method gets executed before the method {@link JedisPool#getResource()}. Based on the mode of Kelpoy it skips
- * the invocation of the method {@link JedisPool#getResource()}
- *
- * @skipOn {@link Advice.OnNonDefaultValue} - this indicates that if any other value except default value of the
- * return type is returned then skip method invocation of intercepting method i.e.
- * {@link JedisPool#getResource()}
- * @return Boolean - Default value false
- */
- @Advice.OnMethodEnter(skipOn = Advice.OnNonDefaultValue.class)
- static boolean enterMethods() {
- final Logger logger = LoggerFactory.getLogger(JedisPoolResource_Advice.class);
- Kcontext kCtx = Context.getCtx();
- if (Objects.isNull(kCtx)) {
- logger.debug("Keploy context is null");
- return false;
- } else {
- return kCtx.getMode().equals(Mode.ModeType.MODE_TEST);
- }
- }
-
- /**
- * This method gets executed after intercepting method {@link JedisPool#getResource()} irrespective of invocation of
- * intercepting method. Based on the return value of the {@link JedisPoolResource_Advice#enterMethods()} it provides
- * {@link Jedis} object as return value to the intercepting method.
- *
- * @param returned - the return object for intercepting method
- * @param enter - the value returned from {@link JedisPoolResource_Advice#enterMethods()}
- */
- @Advice.OnMethodExit()
- static void enterMethods(@Advice.Return(readOnly = false, typing = DYNAMIC) Object returned,
- @Advice.Enter boolean enter ) {
- if(enter){
- returned = new Jedis();
- }
- }
-}
diff --git a/dedupData.yaml/dedupData.yaml b/dedupData.yaml/dedupData.yaml
new file mode 100644
index 00000000..e69de29b
diff --git a/integration/pom.xml b/integration/pom.xml
index 198a6115..447be554 100644
--- a/integration/pom.xml
+++ b/integration/pom.xml
@@ -23,6 +23,16 @@
1.0.0-SNAPSHOT
compile
+
+ org.jline
+ jline
+ 3.20.0
+
+
+ me.tongfei
+ progressbar
+ 0.5.5
+
io.keploy
common
@@ -60,11 +70,11 @@
2.1.214
provided
-
-
-
-
-
+
+ org.yaml
+ snakeyaml
+ 1.28
+
org.mariadb.jdbc
mariadb-java-client
@@ -82,7 +92,6 @@
okhttp
3.14.9
- provided
org.apache.httpcomponents
@@ -103,6 +112,11 @@
1.11.857
provided
+
+ org.jacoco
+ org.jacoco.core
+ 0.8.7
+
com.google.maps
google-maps-services
@@ -115,15 +129,19 @@
2.11.0
- com.google.code.gson
- gson
- 2.8.9
+ io.btrace
+ btrace-client
+ 2.2.3
+
+
+ io.btrace
+ btrace-agent
+ 2.2.3
-
- redis.clients
- jedis
- 2.9.3
+ io.btrace
+ btrace-boot
+ 2.2.3
diff --git a/integration/src/main/java/io/keploy/redis/jedis/KConnection.java b/integration/src/main/java/io/keploy/redis/jedis/KConnection.java
deleted file mode 100644
index 4aa2a15e..00000000
--- a/integration/src/main/java/io/keploy/redis/jedis/KConnection.java
+++ /dev/null
@@ -1,550 +0,0 @@
-package io.keploy.redis.jedis;
-
-import com.google.gson.Gson;
-import com.google.gson.reflect.TypeToken;
-import io.keploy.grpc.stubs.Service;
-import io.keploy.regression.KeployInstance;
-import io.keploy.regression.Mock;
-import io.keploy.regression.Mode;
-import io.keploy.regression.context.Context;
-import io.keploy.regression.context.Kcontext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import redis.clients.jedis.Connection;
-import redis.clients.jedis.Protocol;
-import redis.clients.util.SafeEncoder;
-
-import javax.net.ssl.HostnameVerifier;
-import javax.net.ssl.SSLParameters;
-import javax.net.ssl.SSLSocketFactory;
-import java.lang.reflect.Type;
-import java.net.Socket;
-import java.util.*;
-
-/**
- * KConnection is a class which extends Connection class and wraps it. KConnection records data in record mode and sends
- * data in test mode.
- */
-public class KConnection extends Connection {
-
- static final Logger logger = LoggerFactory.getLogger(KConnection.class);
- private final Mode.ModeType keployMode = Context.getCtx().getMode().getModeFromContext();
- private Map meta = new HashMap() {
- {
- put("name", "redis");
- put("type", "NoSqlDB");
- }
- };
- private static final RedisCustomSerializer redisCustomSerializer = new RedisCustomSerializer();
- private static final Gson gson = new Gson();
- private static final String CROSS = new String(Character.toChars(0x274C));
- private static final byte[][] EMPTY_ARGS = new byte[0][];
-
- public KConnection() {
- super();
- // fill data in Mock object into meta if application is in test mode.
- if (keployMode == Mode.ModeType.MODE_TEST) {
- fillMock();
- }
- }
-
- public KConnection(String host) {
- super(host);
- // fill data in Mock object into meta if application is in test mode.
- if (keployMode == Mode.ModeType.MODE_TEST) {
- fillMock();
- }
- }
-
- public KConnection(String host, int port) {
- super(host, port);
- // fill data in Mock object into meta if application is in test mode.
- if (keployMode == Mode.ModeType.MODE_TEST) {
- fillMock();
- }
- }
-
- public KConnection(String host, int port, boolean ssl) {
- super(host, port, ssl);
- // fill data in Mock object into meta if application is in test mode.
- if (keployMode == Mode.ModeType.MODE_TEST) {
- fillMock();
- }
- }
-
- public KConnection(String host, int port, boolean ssl, SSLSocketFactory sslSocketFactory, SSLParameters sslParameters, HostnameVerifier hostnameVerifier) {
- super(host, port, ssl, sslSocketFactory, sslParameters, hostnameVerifier);
- // fill data in Mock object into meta if application is in test mode.
- if (keployMode == Mode.ModeType.MODE_TEST) {
- fillMock();
- }
- }
-
- @Override
- public Socket getSocket() {
- return super.getSocket();
- }
-
- @Override
- public int getConnectionTimeout() {
- return super.getConnectionTimeout();
- }
-
- @Override
- public int getSoTimeout() {
- return super.getSoTimeout();
- }
-
- @Override
- public void setConnectionTimeout(int connectionTimeout) {
- super.setConnectionTimeout(connectionTimeout);
- }
-
- @Override
- public void setSoTimeout(int soTimeout) {
- super.setSoTimeout(soTimeout);
- }
-
- @Override
- public void setTimeoutInfinite() {
- super.setTimeoutInfinite();
- }
-
- @Override
- public void rollbackTimeout() {
- super.rollbackTimeout();
- }
-
- @Override
- protected Connection sendCommand(Protocol.Command cmd, String... args) {
- switch (keployMode) {
- case MODE_RECORD:
- /*
- if the request has reached this function it means that request did not send byte data instead request
- sent objects. So Redis uses its default serializer to serialize the data.
- */
- meta.put("serializer", SerializationType.REDIS_SERIALIZATION.toString());
- // capturing request data
- meta.put("command", cmd.toString());
- int argCount = 1;
- for (String arg : args) {
- meta.put("arg".concat(Integer.toString(argCount)), arg);
- argCount++;
- }
- return super.sendCommand(cmd, args);
- case MODE_TEST:
- /*
- Implementing super class logic and calling function of this class. So the flow doesn't divert
- completely to Connection class.
- */
- byte[][] bargs = new byte[args.length][];
- for (int i = 0; i < args.length; ++i) {
- bargs[i] = SafeEncoder.encode(args[i]);
- }
- return this.sendCommand(cmd, bargs);
- default:
- return super.sendCommand(cmd, args);
- }
- }
-
- @Override
- protected Connection sendCommand(Protocol.Command cmd) {
- /*
- Implementing super class logic and calling function of this class. So the flow doesn't divert
- completely to Connection class.
- */
- return this.sendCommand(cmd, EMPTY_ARGS);
- }
-
- @Override
- protected Connection sendCommand(Protocol.Command cmd, byte[]... args) {
- switch (keployMode) {
- case MODE_RECORD:
- /*
- Checking if serializer is already set if not that means request sent bytes data i.e. before reaching
- redis client serialization is done. As REDIS_CUSTOM_SERIALIZATION is the most used serializer using this
- serializer.
- */
- if (!meta.containsKey("serializer") || !Objects.equals(meta.get("serializer"), SerializationType.REDIS_SERIALIZATION.toString())) {
- meta.put("serializer", SerializationType.REDIS_CUSTOM_SERIALIZATION.toString());
- // capturing data
- meta.put("command", cmd.toString());
- int argCount = 1;
- for (byte[] arg : args) {
- Object deserializedObject = redisCustomSerializer.deserialize(arg);
- meta.put("arg".concat(Integer.toString(argCount)), gson.toJson(deserializedObject));
- argCount++;
- }
- }
- return super.sendCommand(cmd, args);
- case MODE_TEST:
- /*
- Returning this class instead of Connection
- */
- return this;
- default:
- return super.sendCommand(cmd, args);
- }
- }
-
- @Override
- public String getHost() {
- return super.getHost();
- }
-
- @Override
- public void setHost(String host) {
- super.setHost(host);
- }
-
- @Override
- public int getPort() {
- return super.getPort();
- }
-
- @Override
- public void setPort(int port) {
- super.setPort(port);
- }
-
- @Override
- public void connect() {
- switch (keployMode) {
- case MODE_TEST:
- // does nothing
- break;
- default:
- super.connect();
- }
- }
-
- @Override
- public void close() {
- this.disconnect();
- }
-
- @Override
- public void disconnect() {
- switch (keployMode) {
- case MODE_TEST:
- break;
- // does nothing
- default:
- super.disconnect();
- }
- }
-
- @Override
- public boolean isConnected() {
- return super.isConnected();
- }
-
- @Override
- public String getStatusCodeReply() {
- switch (keployMode) {
- case MODE_RECORD:
- // capturing data
- String statusCodeReply = super.getStatusCodeReply();
- meta.put("response", statusCodeReply);
- sendToServer();
- return statusCodeReply;
- case MODE_TEST:
- // returning recorded data
- return meta.get("response");
- default:
- return super.getStatusCodeReply();
- }
- }
-
- @Override
- public String getBulkReply() {
- switch (keployMode) {
- case MODE_RECORD:
- // capturing data
- String bulkReply = super.getBulkReply();
- meta.put("response", bulkReply);
- sendToServer();
- return bulkReply;
- case MODE_TEST:
- // returning recorded data
- return meta.get("response");
- default:
- return super.getBulkReply();
- }
- }
-
- @Override
- public byte[] getBinaryBulkReply() {
- switch (keployMode) {
- case MODE_RECORD:
- /*
- Checking if serializer is already set if not that means request sent bytes data i.e. before reaching
- redis client serialization is done. As REDIS_CUSTOM_SERIALIZATION is the most used serializer using this
- serializer.
- */
- if (Objects.equals(meta.get("serializer"), SerializationType.REDIS_SERIALIZATION.toString())) {
- return super.getBinaryBulkReply();
- } else {
- // capturing data
- byte[] binaryBulkReply = super.getBinaryBulkReply();
- Object deserializedObject = redisCustomSerializer.deserialize(binaryBulkReply);
- meta.put("response", gson.toJson(deserializedObject));
- sendToServer();
- return binaryBulkReply;
- }
- case MODE_TEST:
- // returning recorded data based on serializer
- if (!Objects.equals(meta.get("serializer"), SerializationType.REDIS_SERIALIZATION.toString())) {
- return redisCustomSerializer.serialize(gson.fromJson(meta.get("response"), Object.class));
- }
- return super.getBinaryBulkReply();
- default:
- return super.getBinaryBulkReply();
- }
- }
-
- @Override
- public Long getIntegerReply() {
- switch (keployMode) {
- case MODE_RECORD:
- // recording data
- Long integerReply = super.getIntegerReply();
- meta.put("response", integerReply.toString());
- sendToServer();
- return integerReply;
- case MODE_TEST:
- // sending recorded data
- return Long.parseLong(meta.get("response"));
- default:
- return super.getIntegerReply();
- }
- }
-
- @Override
- public List getMultiBulkReply() {
- switch (keployMode) {
- case MODE_RECORD:
- // recording data
- List multiBulkReply = super.getMultiBulkReply();
- meta.put("response", multiBulkReply.toString());
- sendToServer();
- return multiBulkReply;
- case MODE_TEST:
- // sending recorded data
- return new ArrayList(Arrays.asList(meta.get("response").split(",")));
- default:
- return super.getMultiBulkReply();
- }
- }
-
- @Override
- public List getBinaryMultiBulkReply() {
- switch (keployMode) {
- case MODE_RECORD:
- /*
- Checking if serializer is already set if not that means request sent bytes data i.e. before reaching
- redis client serialization is done. As REDIS_CUSTOM_SERIALIZATION is the most used serializer ,using this
- serializer.
- */
- if (Objects.equals(meta.get("serializer"), SerializationType.REDIS_SERIALIZATION.toString())) {
- return super.getBinaryMultiBulkReply();
- } else {
- // recording data
- List binaryMultiBulkReply = super.getBinaryMultiBulkReply();
- List