diff --git a/jdk_17_maven/em/embedded/rest/digitalbanking/src/main/java/em/embedded/digitalbanking/EmbeddedEvoMasterController.java b/jdk_17_maven/em/embedded/rest/digitalbanking/src/main/java/em/embedded/digitalbanking/EmbeddedEvoMasterController.java index 1532f1b6a..7c39935f5 100644 --- a/jdk_17_maven/em/embedded/rest/digitalbanking/src/main/java/em/embedded/digitalbanking/EmbeddedEvoMasterController.java +++ b/jdk_17_maven/em/embedded/rest/digitalbanking/src/main/java/em/embedded/digitalbanking/EmbeddedEvoMasterController.java @@ -8,6 +8,7 @@ import org.evomaster.client.java.sql.DbSpecification; import org.evomaster.client.java.controller.problem.ProblemInfo; import org.evomaster.client.java.controller.problem.RestProblem; +import org.evomaster.client.java.controller.redis.ReflectionBasedRedisClient; import org.springframework.boot.SpringApplication; import org.springframework.context.ConfigurableApplicationContext; import org.testcontainers.containers.GenericContainer; @@ -95,6 +96,12 @@ public static void main(String[] args) { private UnifiedJedis redisClient; + /** + * Separate from {@link #redisClient}: this is the connection EvoMaster itself uses to compute + * Redis heuristics and to insert data satisfying failed FT.SEARCH/FT.AGGREGATE commands. + */ + private ReflectionBasedRedisClient redisHeuristicsClient; + public EmbeddedEvoMasterController() { this(0); } @@ -113,6 +120,8 @@ public String startSut() { initCassandraSchema(); redisClient = new JedisPooled("redis://:" + REDIS_PASSWORD + "@" + redis.getHost() + ":" + redis.getMappedPort(REDIS_PORT)); + redisHeuristicsClient = new ReflectionBasedRedisClient( + redis.getHost(), redis.getMappedPort(REDIS_PORT), 0, REDIS_PASSWORD); ctx = SpringApplication.run(DemoApplication.class, new String[]{ "--server.port=0", @@ -167,6 +176,11 @@ public void stopSut() { redisClient = null; } + if (redisHeuristicsClient != null) { + redisHeuristicsClient.close(); + redisHeuristicsClient = null; + } + cassandra.stop(); kafka.stop(); redis.stop(); @@ -177,6 +191,11 @@ public String getPackagePrefixesToCover() { return "com.jphaugla."; } + @Override + public ReflectionBasedRedisClient getRedisConnection() { + return redisHeuristicsClient; + } + /* Redis is the only store that keeps state across tests. FLUSHALL would drop the RediSearch indexes, which the SUT creates only at startup. diff --git a/jdk_17_maven/em/external/rest/digitalbanking/src/main/java/em/external/digitalbanking/ExternalEvoMasterController.java b/jdk_17_maven/em/external/rest/digitalbanking/src/main/java/em/external/digitalbanking/ExternalEvoMasterController.java index c035b6076..b629f80c5 100644 --- a/jdk_17_maven/em/external/rest/digitalbanking/src/main/java/em/external/digitalbanking/ExternalEvoMasterController.java +++ b/jdk_17_maven/em/external/rest/digitalbanking/src/main/java/em/external/digitalbanking/ExternalEvoMasterController.java @@ -8,6 +8,7 @@ import org.evomaster.client.java.sql.DbSpecification; import org.evomaster.client.java.controller.problem.ProblemInfo; import org.evomaster.client.java.controller.problem.RestProblem; +import org.evomaster.client.java.controller.redis.ReflectionBasedRedisClient; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.wait.strategy.Wait; import org.testcontainers.kafka.KafkaContainer; @@ -122,6 +123,12 @@ public static void main(String[] args) { private UnifiedJedis redisClient; + /** + * Separate from {@link #redisClient}: this is the connection EvoMaster itself uses to compute + * Redis heuristics and to insert data satisfying failed FT.SEARCH/FT.AGGREGATE commands. + */ + private ReflectionBasedRedisClient redisHeuristicsClient; + public ExternalEvoMasterController() { this(DEFAULT_CONTROLLER_PORT, "../target/digitalbanking-sut.jar", DEFAULT_SUT_PORT, 120, "java"); } @@ -197,6 +204,8 @@ public void preStart() { initCassandraSchema(); redisClient = new JedisPooled("redis://:" + REDIS_PASSWORD + "@" + redis.getHost() + ":" + redis.getMappedPort(REDIS_PORT)); + redisHeuristicsClient = new ReflectionBasedRedisClient( + redis.getHost(), redis.getMappedPort(REDIS_PORT), 0, REDIS_PASSWORD); } private void initCassandraSchema() { @@ -221,6 +230,10 @@ public void postStop() { redisClient.close(); redisClient = null; } + if (redisHeuristicsClient != null) { + redisHeuristicsClient.close(); + redisHeuristicsClient = null; + } cassandra.stop(); kafka.stop(); redis.stop(); @@ -231,6 +244,11 @@ public String getPackagePrefixesToCover() { return "com.jphaugla."; } + @Override + public ReflectionBasedRedisClient getRedisConnection() { + return redisHeuristicsClient; + } + @Override public ProblemInfo getProblemInfo() { return new RestProblem( diff --git a/jdk_21_maven/em/embedded/rest/redis-sample/src/main/java/em/embedded/redis/sample/EmbeddedEvoMasterController.java b/jdk_21_maven/em/embedded/rest/redis-sample/src/main/java/em/embedded/redis/sample/EmbeddedEvoMasterController.java index fe63293d3..bfd2bf54c 100644 --- a/jdk_21_maven/em/embedded/rest/redis-sample/src/main/java/em/embedded/redis/sample/EmbeddedEvoMasterController.java +++ b/jdk_21_maven/em/embedded/rest/redis-sample/src/main/java/em/embedded/redis/sample/EmbeddedEvoMasterController.java @@ -8,6 +8,7 @@ import org.evomaster.client.java.sql.DbSpecification; import org.evomaster.client.java.controller.problem.ProblemInfo; import org.evomaster.client.java.controller.problem.RestProblem; +import org.evomaster.client.java.controller.redis.ReflectionBasedRedisClient; import org.springframework.boot.SpringApplication; import org.springframework.context.ConfigurableApplicationContext; import org.testcontainers.containers.GenericContainer; @@ -62,6 +63,12 @@ public static void main(String[] args) { private StatefulRedisConnection redisConnection; + /** + * Separate from {@link #redisConnection}: this is the connection EvoMaster itself uses to compute + * Redis heuristics and to insert data satisfying failed Redis commands. + */ + private ReflectionBasedRedisClient redisHeuristicsClient; + public EmbeddedEvoMasterController() { this(0); } @@ -78,6 +85,8 @@ public String startSut() { redisClient = RedisClient.create("redis://:" + REDIS_PASSWORD + "@" + redis.getHost() + ":" + redis.getMappedPort(REDIS_PORT)); redisConnection = redisClient.connect(); + redisHeuristicsClient = new ReflectionBasedRedisClient( + redis.getHost(), redis.getMappedPort(REDIS_PORT), 0, REDIS_PASSWORD); ctx = SpringApplication.run(SpringBootRedisSampleApplication.class, new String[]{ "--server.port=0", @@ -120,6 +129,11 @@ public void stopSut() { redisClient = null; } + if (redisHeuristicsClient != null) { + redisHeuristicsClient.close(); + redisHeuristicsClient = null; + } + redis.stop(); } @@ -128,6 +142,11 @@ public String getPackagePrefixesToCover() { return "id.my.hendisantika.springbootredissample."; } + @Override + public ReflectionBasedRedisClient getRedisConnection() { + return redisHeuristicsClient; + } + /* Only the Spring Cache entries accumulate: the API is read-only, and the seeded data is written once at startup by runners guarded on an empty repository, so it must survive. diff --git a/jdk_21_maven/em/external/rest/redis-sample/src/main/java/em/external/redis/sample/ExternalEvoMasterController.java b/jdk_21_maven/em/external/rest/redis-sample/src/main/java/em/external/redis/sample/ExternalEvoMasterController.java index 69afea8ec..c4d7e4874 100644 --- a/jdk_21_maven/em/external/rest/redis-sample/src/main/java/em/external/redis/sample/ExternalEvoMasterController.java +++ b/jdk_21_maven/em/external/rest/redis-sample/src/main/java/em/external/redis/sample/ExternalEvoMasterController.java @@ -8,6 +8,7 @@ import org.evomaster.client.java.sql.DbSpecification; import org.evomaster.client.java.controller.problem.ProblemInfo; import org.evomaster.client.java.controller.problem.RestProblem; +import org.evomaster.client.java.controller.redis.ReflectionBasedRedisClient; import org.testcontainers.containers.GenericContainer; import io.lettuce.core.RedisClient; import io.lettuce.core.api.StatefulRedisConnection; @@ -89,6 +90,12 @@ public static void main(String[] args) { private StatefulRedisConnection redisConnection; + /** + * Separate from {@link #redisConnection}: this is the connection EvoMaster itself uses to compute + * Redis heuristics and to insert data satisfying failed Redis commands. + */ + private ReflectionBasedRedisClient redisHeuristicsClient; + public ExternalEvoMasterController() { this(DEFAULT_CONTROLLER_PORT, "../target/redis-sample-sut.jar", DEFAULT_SUT_PORT, 120, "java"); } @@ -157,6 +164,8 @@ public void preStart() { redisClient = RedisClient.create("redis://:" + REDIS_PASSWORD + "@" + redis.getHost() + ":" + redis.getMappedPort(REDIS_PORT)); redisConnection = redisClient.connect(); + redisHeuristicsClient = new ReflectionBasedRedisClient( + redis.getHost(), redis.getMappedPort(REDIS_PORT), 0, REDIS_PASSWORD); } @Override @@ -176,6 +185,11 @@ public void postStop() { redisClient = null; } + if (redisHeuristicsClient != null) { + redisHeuristicsClient.close(); + redisHeuristicsClient = null; + } + redis.stop(); } @@ -184,6 +198,11 @@ public String getPackagePrefixesToCover() { return "id.my.hendisantika.springbootredissample."; } + @Override + public ReflectionBasedRedisClient getRedisConnection() { + return redisHeuristicsClient; + } + @Override public ProblemInfo getProblemInfo() { return new RestProblem(